Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

What is the exact syntax to shutdown remote Win2k8 server using WMIC?

(The reason WMIC must be used is because the remote machine in a different NT Domain and the local machine does not have access to that domain. WMIC takes /user: and /password: parameters and auths against remote machine itself.)

These don't work:

wmic /node:10.162.x.x /user:tech1\xxxx /password:xxxx os call Shutdown

Executing (Win32_OperatingSystem)->Shutdown()

ERROR: Code = 0x8004102f Description = Invalid method Parameter(s)

Facility = WMI


wmic /node:10.162.x.x /user:tech1\xxxx /password:xxxx os call Shutdown(1)

Verb Or Method has no input parameters.


wmic /node:10.162.x.x /user:tech1\xxxx /password:xxxx os call Win32Shutdown(1)

Executing (Win32_OperatingSystem)->Win32Shutdown()

ERROR:

Code = 0x8004102f

Description = Invalid method Parameter(s)

Facility = WMI


wmic /node:10.162.x.x /user:tech1\xxxx /password:xxxx path Win32_OperatingSystem call Shutdown(1)

Verb Or Method has no input parameters.


wmic /node:10.162.x.x /user:tech1\xxxx /password:xxxx path Win32_OperatingSystem call Shutdown

Executing (Win32_OperatingSystem)->Shutdown()

ERROR: Code = 0x8004102f Description = Invalid method Parameter(s) Facility = WMI

share|improve this question
    
any reason to not just use shutdown /m –  tony roth Jun 28 '10 at 21:19
    
@tony: "The reason WMIC must be used is because the remote machine in a different NT Domain and the local machine does not have access to that domain. WMIC takes /user: and /password: parameters and auths against remote machine itself." –  zvolkov Jun 29 '10 at 14:24
    
gut feeling is that you'll need a where clause to qualify what your rebooting. –  tony roth Jun 29 '10 at 15:16

3 Answers 3

I don't know why WMIC wont work, but the powershell version does work:

$cred = get-credential tech1\xxxxx
(gwmi -comp 10.162.x.x -cred $cred Win32_OperatingSystem).Shutdown()

You'll be prompted for the password, there's no way around it prompting you for the password.

share|improve this answer
    
this really is the way to go! –  tony roth Jun 29 '10 at 19:02
    
can't script it then :( thanks anyway –  zvolkov Jul 18 '10 at 1:40

the 1st one but you need a space between the ipaddress and the /user:

add a where clause

something like

wmic os where "version like '%'" call win32shutdown 2

share|improve this answer
wmic /node: "machinename" os where primary="true" call shutdown

Must have space after : Must have quotes around machinename and true

use /user:username between machinename and os if you need to authenticate

share|improve this answer
    
Hello and welcome to serverfault. Please take the time to format and comment sample code when posting an answer. –  Stephane May 7 '13 at 7:06

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.