Sounds simple – I want to run a command script on a remote machine on my home network to update my media libraries. Previously I had logged in via remote desktop Turned out to be slightly more complicated….
I needed PsExec from the useful set of Sysinternal tools. You run it from within its folder or place the psexec.exe file in the “%windir%” directory will allow you to call it straight from the command prompt. I bodged together a little script that I run on my local machine to execute the cmd on the remote machine – more about YAMJ later…
In the following script psexec is in the folder C:\pstools on my local PC and the cmd script is in C:\YAMJ on the remote PC, and vail is the network name of my home server (open notepad, copy it in and adjust for your own paths/username/password and save it as a .bat file)
@Echo off
c:
cd\
cd c:\pstools
psexec \\vail -u USERNAME -p PASSWORD C:\YAMJ\My_YAMJ_2libraries_combined.cmd
echo Update Complete
pause
exit
The quirky thing about this is both local and remote machines are running Windows 7 but the batch file only works when I ‘Run as Administrator’ it locally. I’m sure I could add code into to run it at an elevated level automagically, but haven’t worked that out yet.
/update – it gets stranger – I need to shift-rt_click on the shortcut and ‘run as’ entering the admin credentials i use on the remote machine and it works, using the ‘run as admiinistrator’ leads to the ‘access denied’ message. The latter used to work, not sure why it stopped….
What the batch file does is update my TV and Film library on a remote machine which uses YAMJ as a frontend.