join a samba domain

Toff christophedeze at gmail.com
Mon Dec 22 18:27:14 CET 2008


On 22 déc, 17:57, Tim Golden <m... at timgolden.me.uk> wrote:
> Toff wrote:
> > On 22 déc, 17:02, Tim Golden <m... at timgolden.me.uk> wrote:
> >> 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
> > thanks but it doesn't work
> > I've got this errors
>
> > Traceback (most recent call last):
> >  File "integrdom.py", line 51, in <module>
> >    main()
> >  File "integrdom.py", line 13, in main
> >    joindom()
> >  File "integrdom.py", line 44, in joindom
> >    d.JoinDomainOrWorkGroup(None, 3, "domcd", "adminLocal", r"admin
> > \domcd")
> >  File "c:\Python25\Lib\site-packages\wmi.py", line 493, in __getattr__
> >    handle_com_error (error_info)
> >  File "c:\Python25\Lib\site-packages\wmi.py", line 189, in
> > handle_com_error
> >    raise x_wmi, "\n".join (exception_string)
> > wmi.x_wmi
>
> Do you not get *anything* after than wmi.x_wmi? Not even
> a messy exception string?
>
> TJG

no pessy string

something strange:

        import wmi
        c = wmi.WMI()
        os = c.Win32_ComputerSystem
        for method_name in os.methods:
          method = getattr(os, method_name)
          print method

it doesn't give the same parameter order for JoinDomainOrWorkGroup
than MSDN doc



More information about the Python-list mailing list