Instead of using Win32_OperatingSystem's Reboot() method, you're probably
better off using its Win32Shutdown; this allows you forced shutdown (trying
to kill all processes isn't going to work - it will kill your own script as
well, and some processes won't be touched).
You want to specify restart + forcing, which is a value of 6 if you check
the online documentation for the method:
http://msdn.microsoft.com/en-us/libr...8VS.85%29.aspx
so use it like this:
OpSys.Win32Shutdown( 6, 0)
"Joey" <> wrote in message
news:#A$...
> yes after joining the domain, there isa process that keeps hanging and
> waiting for a "end now". I want to be able to kill that process and then
> reboot
>
> "Alex K. Angelopoulos" <alex(dot) k(dot again)angelopoulos(at)gmail.com>
> wrote in message news:...
>> Since you're using the Reboot() method, that will happen automatically.
>> Are you running into problems with making this work in a specific
>> situation?
>>
>> "Joey" <> wrote in message
>> news:...
>>> ok
>>>
>>> how do I add a line that will kill all processes ?
>>>
>>> Set objNetwork = CreateObject("WScript.Network")
>>> strComputer = objNetwork.ComputerName
>>> Set objComputer =
>>> GetObject("winmgmts:{impersonationLevel=Impersonat e}!\\" & strComputer &
>>> "\root\cimv2:Win32_ComputerSystem.Name='" & strComputer & "'")
>>> 'strDomain = objComputer.Domain
>>> intReturn = objComputer.UnjoinDomainOrWorkgroup (NULL,NULL,0)
>>> intReturn1 = objComputer.JoinDomainOrWorkgroup("workgroup")
>>>
>>>
>>> Set OpSysSet =
>>> GetObject("winmgmts:{(Shutdown)}!\\.\root\cimv2"). ExecQuery _
>>> ("select * from Win32_OperatingSystem where Primary=true")
>>>
>>> for each OpSys in OpSysSet
>>> OpSys.Reboot()
>>> next
>>>
>>>
>>>
>>> "Alex K. Angelopoulos" <aka(at)mvps.org> wrote in message
>>> news:%...
>>>> First, is the computer currently a domain member, not a workgroup
>>>> member? If so - and only if so - you first need to use the
>>>> UnjoinDomainOrWorkgroup the way you have it.
>>>>
>>>> The second step is to use JoinDomainOrWorkgroup, like this:
>>>>
>>>> objComputer.JoinDomainOrWorkgroup("workgroup")
>>>>
>>>>
>>>> you have the necessary privileges, don't bother with arguments
>>>>
>>>> "Joey" <> wrote in message
>>>> news:eIAv$...
>>>>> how do I modify the below to join a workgroup name "workgroup" instead
>>>>> of the domain name?
>>>>>
>>>>> Set objNetwork = CreateObject("WScript.Network")
>>>>> strComputer = objNetwork.ComputerName
>>>>> Set objComputer =
>>>>> GetObject("winmgmts:{impersonationLevel=Impersonat e}!\\" & strComputer
>>>>> & "\root\cimv2:Win32_ComputerSystem.Name='" & strComputer & "'")
>>>>> strDomain = objComputer.Domain
>>>>> intReturn = objComputer.UnjoinDomainOrWorkgroup (NULL,NULL,0)
>>>>>
>>>
>>>
>
>