candera / shadowspawn

A Windows utility that mounts a shadow copy of the disk at a drive letter and then spawns an arbitrary command.
MIT License
184 stars 55 forks source link

Not working when launched from windows 7 task scheduler #17

Open trokolo opened 10 years ago

trokolo commented 10 years ago

Hello from Spain. I am using for first time this great tool. The os is Windows 7 Pro. I have a bat file that uses shadowspawn.exe to create a snapshot of my d: logical unit and mount it on letter k:. In the same command I have another bat that launches robocopy to copy some folders. Something like this:

step1.bat: shadowspawn D:\ K: step2.bat

step2.bat Robocopy /MIR "K:\Data" "\Server\Backup\data" Robocopy /MIR "K:\Data2" "\Server\Backup\data2" ...

If I launch step1.bat directly doing doubleclick it works perfectly. But if I put them into a scheduled task it not works. The scheduled task is running with highest privileges and into a Admin account (the same account that is running). Any ideas of what can be happening?

Thank you so much.

garethaowen commented 10 years ago

If you break out your bat file and run each line separately they work. Create them each as an action in the scheduled tasks.

i.e.

Action 1: Program: shadowspawn Paramaters: D:\ K: Robocopy /MIR "K:\Data" "\Server\Backup\data"

Action 2: Program: shadowspawn Paramaters: D:\ K: Robocopy /MIR "K:\Data2" "\Server\Backup\data2"

therentabrain commented 2 years ago

nearly ten years late, and I haven't tried this, but I'm going to guess that a faster solution might be to use shadowspawn to start a batch file using cmd /k. I imagine that cmd would stay open and run whatever until the batch file ends.