Solved

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

Posted on 2011-03-22
4
624 Views
Last Modified: 2012-05-11
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
Comment
Question by:Gig-A-Dee
  • 2
  • 2
4 Comments
 
LVL 12

Accepted Solution

by:
GusGallows earned 500 total points
ID: 35193389
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
 
LVL 1

Author Comment

by:Gig-A-Dee
ID: 35194033
Thanks. The issue is this task hangs for days. We need to see it's progress.
0
 
LVL 1

Author Comment

by:Gig-A-Dee
ID: 35194128
Is there a benefit running it under PowerShell?
0
 
LVL 12

Expert Comment

by:GusGallows
ID: 35206877
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

VMware Disaster Recovery and Data Protection

In this expert guide, you’ll learn about the components of a Modern Data Center. You will use cases for the value-added capabilities of Veeam®, including combining backup and replication for VMware disaster recovery and using replication for data center migration.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
MS Project Critical Path 4 101
Is  Microsoft IIS 7 retired? 4 140
Automatically Update Cross Reference Field in Document Header 2 57
Convert Access 97 .mdb file to .accdb file 16 126
The canonical version of this article is on my web site here: http://iconoun.com/articles/collisions/ A companion presentation is available here: http://iconoun.com/articles/collisions/Unicode_Presentation.pdf
User Beware!  This is a rather permanent solution to removing your email from an exchange server.  The only way to truly go back is to have your exchange administrator restore your mailbox from backups.  This is usually the option of last resort.  A…
The viewer will learn how to use the =DISCRINV command to create a discrete random variable, use this command to model a set of probabilities and outcomes in a Monte Carlo simulation, and learn how to find the standard deviation of a set of probabil…
The viewer will learn how to create a normally distributed random variable in Excel, use a normal distribution to simulate the return on an investment over a period of years, Create a Monte Carlo simulation using a normal random variable, and calcul…

786 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question