[python-win32] Invalid method parameters with UnjoinDomainOrWorkgroup
Gowtham
narisipalli at gmail.com
Tue Dec 22 21:41:08 CET 2009
Hi Tim,
Inline-
On Tue, Dec 22, 2009 at 2:42 PM, Tim Roberts <timr at probo.com> 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, timr at probo.com
> Providenza & Boekelheide, Inc.
>
> _______________________________________________
> python-win32 mailing list
> python-win32 at python.org
> http://mail.python.org/mailman/listinfo/python-win32
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-win32/attachments/20091222/63e65b31/attachment.htm>
More information about the python-win32
mailing list