[Last Call] Learn how to a build a cloud-first strategyRegister Now

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 677
  • Last Modified:

Do Windows Srvr 2008 64 bit batch files run in power shell or command prompts?

I have a Windows 2008 ENT 64bit server. There's an existing batch file that the task scheduler fires off each night. I need to see the progress of this task; can I run the batch file in powershell or just from command prompt?

Here's the Batch:
REM Hyper-V Virtual Machine Backup

REM Shutdown virtual machines
%SystemRoot%\system32\WindowsPowerShell\v1.0\powershell.exe d:\admin\Hyperv_VMBackup\scripts\vmbackup\StartStopVms.ps1 d:\admin\HyperV_VMBackup\scripts\vmbackup\VmNamesStop.txt 1

REM Copy virtual machines, /Y overwrites the file if it already exists
copy /Y "D:\VM\Edge-TS1\Edge-TS1.vhd" "D:\VM\vm_backups\Edge-TS1\Edge-TS1.vhd"
copy /Y "D:\VM\Edge-Acct\Edge-Acct.vhd" "D:\VM\vm_backups\Edge-Acct\Edge-Acct.vhd"
copy /Y "D:\VM\Edge-SQL\Edge-SQL.vhd" "D:\VM\vm_backups\Edge-SQL\Edge-SQL.vhd"
copy /Y "D:\VM\Edge-Helpdesk\Edge-helpdesk.vhd" "D:\VM\vm_backups\Edge-helpdesk\Edge-helpdesk.vhd"

REM Power on virtual machines
%SystemRoot%\system32\WindowsPowerShell\v1.0\powershell.exe d:\admin\HyperV_VMBackup\scripts\vmbackup\StartStopVms.ps1 d:\admin\HyperV_VMBackup\scripts\vmbackup\VmNamesStart.txt 0
pause
REM Finished!
0
Gig-A-Dee
Asked:
Gig-A-Dee
  • 2
  • 2
1 Solution
 
GusGallowsCommented:
This will run in command prompt but will open powershell for part of it. The parts that do the shutdown and power on virtual machines is done through a powershell shell.

You could probably remove the "%SystemRoot%\system32\WindowsPowerShell\v1.0\powershell.exe" part and run the whole thing from powershell.

Either way, if it runs in task scheduler it can pretty much always be run from command prompt.
0
 
Gig-A-DeeAuthor Commented:
Thanks. The issue is this task hangs for days. We need to see it's progress.
0
 
Gig-A-DeeAuthor Commented:
Is there a benefit running it under PowerShell?
0
 
GusGallowsCommented:
Only benefit is that it doesn't expend extra memory to open a shell from within the command prompt shell. Other than that, it is pretty negligable.
0

Featured Post

Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

  • 2
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now