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.

I'm an admin of a domain and im trying to run a wmic script to copy a file on a remote pc from another remote pc.

My command:

WMIC /NODE:@"C:\compList.txt" PROCESS CALL Create "xcopy \\networkPC\file.exe C:\"

it doesn't copy file.exe on the computers i've listed on compList.txt, I know it's not a privilage problem because I tried running a simple process of

cmd /c echo 1>C:\1.txt

and it created 1.txt in the remote computer.

What could be the problem?

share|improve this question
add comment

migrated from superuser.com Feb 10 '10 at 9:48

This question came from our site for computer enthusiasts and power users.

2 Answers

up vote 0 down vote accepted

Is it possible you have Windows firewall (or a 3rd party firewall) enabled that is blocking the WMI call? Port 135 needs to be open for WMI to work properly. See this article for details about connecting WMI through a firewall.

Edit:

I did some more digging about this - you problem is how WMIC uses your credentials when it tries to connect to networkPC. You are running WMIC in it's default impersonation mode of "Impersonate" - this allows WMIC to Impersonate your account on the local computer (the computers in compList.txt) - but when it tries to connect to a remote computer (networkPC) it cannot impersonate you, so it connects as NT AUTHORITY\ANONYMOUS LOGON.

I think you have 2 possible solutions here:

  1. Allow the share on networkPC to have read access for NT AUTHORITY\ANONYMOUS LOGON - this is a little more complicated than it sounds - you must give ANONYMOUS LOGON share and file level permissions, as well as allowing it to activate WMI in dcomcfg
  2. Setup your WMIC call to use Delegate impersonation. This requires you to set the user and computer accounts in AD up with "Trusted for Delegation" authority. You can then call wmic with the /IMPLEVEL:Delegate - but this opens up a new problem because you also need to pass in the /AUTHORITY:"kerberos:targetdomain\targetcomputer" parameter - and targetcomputer is the name of the computer from compList.txt - this means you would need to put your wmic calls in a loop around the computers in compList.txt instead of using /NODE:@compList.txt
share|improve this answer
    
no firewall or any blocks at all as i said, there are certain things that i manage to do with WMIC like simply launching EXE files on the remote computer (the EXE launched well on the remote pc) the only problem I'm facing with WMIC is using to copy files from another hostname. –  user34544 Feb 11 '10 at 17:26
    
@aabluedragon - check my edit, I think I figured out your problem, and gave a few possible solutions –  MattB Feb 11 '10 at 22:52
    
Great answer..! –  user34544 Feb 14 '10 at 6:15
add comment

One way I have gotten past this error is to use runas. If you have access to a command line, then use /runas:<domain>\<domainadmin> cmd.exe. You will get a second command line that runs with domain admin credentials. (Note: to perform on windows 7, you may have to elevate past the UAC.)

Once you have your domain admin command line, continue on with WMIC.

C:\\>**runas /user:dom\domadmin cmd.exe**

(will ask for domain admin password, and open a new command prompt)

C:\\>**wmic /node:@c:\list.txt**

then

wmic:root\cli>**call create process "xcopy \\\server\file C:\folder\file"**

should copy over.

share|improve this answer
add comment

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.