Send a batch file to a Windows machine, and execute it

Solution 1:

You can execute a script, or binary, remotely using WMI. This is a minimal example, written in VBS, which runs the batch file C:\test.cmd located on the remote computer FCSD-ISC1.

strComputer = "FCSD-ISC1"
Set objWMIService = GetObject("winmgmts:\\" & strComputer & "\root\cimv2:Win32_Process")
objWMIService.Create "C:\test.cmd", null, null, intProcessID

This is covered in more detail in this Scripting Guy article.

Solution 2:

I recommend mounting the C$ share, testing for the .\Temp directory (creating if it doesn't exist), and copying there. (There is an "admin$" administrative share, but I recommend against using it.)

You can do this from the command line via net use * \\servername\c$ /user:domain/account or specify a drive as net use t: \\servername\c$ /user:domain/account

This should be well documented in MSDN. If writing for a script, there are a lot of examples in the Microsoft Script Center Repository