Hi Tim, Inline-
On Tue, Dec 22, 2009 at 2:42 PM, Tim Roberts <[email protected]> wrote: > Gowtham wrote: > > I am trying to unjoin a machine from the domain and attempted with the > > following code > > > > > > import wmi > > wm = wmi.WMI() > > wm.Win32_ComputerSystem.UnjoinDomainOrWorkgroup(2, 'ADMINPASSWORD', > > 'DOMAIN\ADMINUSER') > > > > Traceback (most recent call last): > > File "<stdin>", line 1, in ? > > File "C:\Python24\Lib\site-packages\wmi.py", line 396, in __call__ > > handle_com_error (error_info) > > File "C:\Python24\Lib\site-packages\wmi.py", line 189, in > > handle_com_error > > raise x_wmi, "\n".join (exception_string) > > wmi.x_wmi: -0x7ffdfff7 - Exception occurred. > > Error in: SWbemObjectEx > > -0x7ffbefd1 - Invalid method Parameter(s) > > > > I dont understand why its calling these Invalid method parameters. All > > that it wants is an (Int, Str, Str) when using thru Python otherwise > > it is (Str, Str, int) as described here. > > http://msdn.microsoft.com/en-us/library/aa393942(VS.85).aspx<http://msdn.microsoft.com/en-us/library/aa393942%28VS.85%29.aspx> > > <http://msdn.microsoft.com/en-us/library/aa393942%28VS.85%29.aspx> > > Why do you believe the parameter list needs to be different when calling > from Python? > > Because- >>> wm.Win32_ComputerSystem.UnjoinDomainOrWorkgroup <function UnjoinDomainOrWorkgroup (FUnjoinOptions, Password, UserName) => (ReturnValue)> The parameter sequence says FUnjoinOption, Password and Username while MOF says uint32 UnjoinDomainOrWorkgroup( [in] string Password, [in] string UserName, [in] uint32 FUnjoinOptions = 0 ); This is confusion for this reason. Thanks. > Also, for safety, if you really do have the literal strings in your > code, you need to protect the backslash in your domain. Either make it > 'DOMAIN\\ADMINUSER' or use a raw string, r'DOMAIN\ADMINUSER'. > > -- > Tim Roberts, [email protected] > Providenza & Boekelheide, Inc. > > _______________________________________________ > python-win32 mailing list > [email protected] > http://mail.python.org/mailman/listinfo/python-win32 >
_______________________________________________ python-win32 mailing list [email protected] http://mail.python.org/mailman/listinfo/python-win32
