I have win xp prof This script print Error 3 line 5 mark.
Whay??

Set colOperatingSystems = GetObject_
("winmgmts:{(Shutdown)}").ExecQuery("Select * from
Win32_OperatingSystem")

For Each objOperatingSystem in colOperatingSystems
ObjOperatingSystem.Win32Shutdown(1)
Next

Re: Not working why?? by Thorsten

Thorsten
Thu Dec 30 05:58:59 CST 2004

Probably because of the missing impersonation level and computer focus?

strComputer = "."
Set objWMIService = GetObject_
("winmgmts:{impersonationLevel=impersonate,(Shutdown)}\\" & _
strComputer & "\root\cimv2")

Set colOperating Systems = objWMIService.ExecQuery _
("Select * from Win32_OperatingSystem")

For Each objOperatingSystem in colOperatingSystems
objOperatingSystem.Win32Shutdown(1)
Next

hth,
Thorsten

"elektryczny" <elektryczny@autograf.pl> schrieb im Newsbeitrag
news:cr0hi2$h8c$1@news.onet.pl...
>I have win xp prof This script print Error 3 line 5 mark.
> Whay??
>
> Set colOperatingSystems = GetObject_
> ("winmgmts:{(Shutdown)}").ExecQuery("Select * from
> Win32_OperatingSystem")
>
> For Each objOperatingSystem in colOperatingSystems
> ObjOperatingSystem.Win32Shutdown(1)
> Next



Re: Not working why?? by elektryczny

elektryczny
Thu Dec 30 08:40:00 CST 2004

Thorsten Helfer wrote:
> Probably because of the missing impersonation level and computer focus?
>
> strComputer = "."
> Set objWMIService = GetObject_
> ("winmgmts:{impersonationLevel=impersonate,(Shutdown)}\\" & _
> strComputer & "\root\cimv2")
>
> Set colOperating Systems = objWMIService.ExecQuery _
> ("Select * from Win32_OperatingSystem")
>
> For Each objOperatingSystem in colOperatingSystems
> objOperatingSystem.Win32Shutdown(1)
> Next
>
> hth,
> Thorsten
>
> "elektryczny" <elektryczny@autograf.pl> schrieb im Newsbeitrag
> news:cr0hi2$h8c$1@news.onet.pl...
>
>>I have win xp prof This script print Error 3 line 5 mark.
>>Whay??
>>
>>Set colOperatingSystems = GetObject_
>> ("winmgmts:{(Shutdown)}").ExecQuery("Select * from
>>Win32_OperatingSystem")
>>
>>For Each objOperatingSystem in colOperatingSystems
>> ObjOperatingSystem.Win32Shutdown(1)
>>Next
>
>
>
THX