join a samba domain
Tim Golden
mail at timgolden.me.uk
Mon Dec 22 11:02:49 EST 2008
Toff wrote:
> hi,
>
> I 'm trying to write a script to make my computer join a samba.
>
> domeone have any idea ??
Ummm. It's not clear if you're saying that your code doesn't
work, or asking for general advice, or what? I'm not in a
position to have my machine join a domain or workgroup, but
you seem to have got most things in place already. The only
thing I would expect to have to change is this last line:
> import wmi
> c = wmi.WMI()
> d = c.Win32_ComputerSystem
> d.JoinDomainOrWorkGroup(None, 3, "mydom", "mydompw", r"admin\\mydom")
because the d is only a WMI *class*, not a WMI *instance*,
so doesn't refer as it should to your computer system but
to the class of computer systems. Try something like this (untested):
<code>
import wmi
c = wmi.WMI ()
for d in c.Win32_ComputerSystem ():
d.JoinDomainOrWorkGroup(None, 3, "mydom", "mydompw", r"admin\\mydom")
</code>
TJG
More information about the Python-list
mailing list