SHARE
TWEET

Remote Commander (permanent)

sweenig Feb 27th, 2014 971 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. @echo off
  2. net use Y: \\sourceserver\d$
  3. for /F %%A in (%1) do (
  4.  echo %%A
  5. ::map a drive to the destination
  6.  net use z: \\%%A\d$
  7. ::copy the updated batch
  8.  copy /y Y:\updateproperties.bat Z:\updateproperties.bat
  9. ::create the scheduled task (the /st argument has to be a 4 digit, military time 8:00 is invalid, it should be 08:00)
  10.  schtasks /create /s %%A /tn "Update Properties" /tr D:\updateproperties.bat /sc daily /st 22:00 /ru System
  11. ::run the task
  12.  schtasks /run /s %%A /tn "Update Properties"
  13. ::disconnect the mapped drive
  14.  net use z: /delete
  15. )
  16. net use y: /delete
RAW Paste Data
Top