Do you need to run the script each time to update the file or do you need to run it just once locally? If the latter, the solution would be to use a very crafty console-based application, PSexec. Please note that you must be an administrator on the machine you are running the script on.
Then you create a folder on a local/mapped drive containing:
- The master batch file that you will run
- The PSexec application itself
- The "payload" that will be run on the remote computer - like the file you need to update and a local batch file that PSexec will run.
My normal PSexec payloads are:
- create a temp file/folder on a remote computer
- run the PSexec pointing to the temporary location
- delete all the files created
an example launcher goes like this:
@echo off
CLS
set /p PCName=Type the Domain Name or IP address of PC:
echo.
COPY local_payload.cmd \\%PCName%\c$\Temp
psexec \\%PCName% C:\Temp\local_payload.cmd
REM after the payload has been launched you can view the output
REM edit: if it does not want to work, try adding an -s switch that will make it run as a system account.
pause
REM here you delete everything after you are finished
DEL \\%PCName%\c$\Temp\SMS_LOCAL.cmd
pause
:eof