No announcement yet.

Scheduled Tasks

  • Filter
  • Time
  • Show
Clear All
new posts

  • Scheduled Tasks

    Hi I am completely out of ideas on what I need to do to get a couple of batch files to run from scheduled tasks.

    Basically I have a collection of VMs running in Hyperv, all but 1 is running windows xp the other is 2k3 std server.

    The first bat file to be run is called vm_suspent.bat and its on the root of c:

    This batch file shuts down all vms using the following script

    net use y: \\femputer\hyper-v

    %SystemRoot%\system32\WindowsPowerShell\v1.0\power shell.exe . C:\hyperv\hyperv.ps1;shutdown-vm izac
    %SystemRoot%\system32\WindowsPowerShell\v1.0\power shell.exe . C:\hyperv\hyperv.ps1;shutdown-vm sage
    %SystemRoot%\system32\WindowsPowerShell\v1.0\power shell.exe . C:\hyperv\hyperv.ps1;shutdown-vm firewarll_log
    %SystemRoot%\system32\WindowsPowerShell\v1.0\power shell.exe . C:\hyperv\hyperv.ps1;shutdown-vm MMS1

    As you can see it maps a drive on another machine, and powers down the VMs, this works fine when I run the batch file manually.

    The 2nd batch file is called backup.bat and is also on the root of c:

    this copies the vm files to the remote drive mapped above, then starts the machines up again using the following.

    xcopy "z:\Virtual Machines\sage" "y:\%DATE%\sage" /I /Y
    %SystemRoot%\system32\WindowsPowerShell\v1.0\power shell.exe . C:\hyperv\hyperv.ps1;start-vm sage

    xcopy "z:\Virtual Machines\MMS1" "y:\%DATE%\MMS1" /I /Y
    %SystemRoot%\system32\WindowsPowerShell\v1.0\power shell.exe . C:\hyperv\hyperv.ps1;start-vm mms1

    xcopy "z:\Virtual Machines\FWlogs" "y:\%DATE%\FWlogs" /I /Y
    %SystemRoot%\system32\WindowsPowerShell\v1.0\power shell.exe . C:\hyperv\hyperv.ps1;start-vm firewarll_log

    xcopy "z:\Virtual Machines\IZAC" "y:\%DATE%\IZAC" /I /Y
    %SystemRoot%\system32\WindowsPowerShell\v1.0\power shell.exe . C:\hyperv\hyperv.ps1;start-vm izac

    When I try to schedule these I get

    results of 0x800704DD on the first batch file and
    0x8007010B on the 2nd.

    There are no quotation marks in the run in section of the scheduled task, there are no spaces in the names.

    Any help would be very appreciated.