Salta al contenuto principale

PowerShell scripts in Pre/Post commands

Thread needs solution

Hi, I have Acronis Backup&Recovery 2011 Virtual Edition.

Agent installed on Hyper-V node. I create backup plan for a virtual machine which running on that node and in PrePost command field past that commands:
Command: c:\Windows\System32\WindowsPowerShell\v1.0\powershell.exe
Arguments: -File C:\lm\dbg.ps1

dbg.ps1 contents one simple command: Get-ExecutionPolicy.

When I press Check button in "Command Edit" window, dialog with progress bar are shown infinitely.

OS with acronis agent: Windows 2008 R2 Enterprise, PowerShell execution policy set to Unrestricted.

0 Users found this helpful

There are limitations about pre/post commands and agentless backup
http://www.acronis.com/support/documentation/ABR11/index.html#12508.html

Is it only powershell that can't be executed this way?

Does he setup
command: cmd
arguments: /c C:\Windows\System32\WindowsPowerShell\v1.0\powershell.exe -File C:\a1\a.ps1
work ?

Thank you for your reply.

In that article pre/post commands are not executed inside a virtual machine (under guest OS), but I'm trying to execute these commands on the HyperV physical host where the agent is installed.

I tried to create a simple BAT-file:
echo "234"> c:\lm\out.txt
It works perfectly.

Your command is also not working, but if I pass a nonexistent file with the PowerShell script - error are shown fine.

On attached screenshot you can see result of try to execute PowerShell script:
http://imageshack.us/photo/my-images/696/53663311.png/

Allegato Dimensione
80073-97753.png 124.15 KB

It's weird, but when I specified full path c:\windows\system32\cmd.exe as you do, or 'cmd.exe' I got the same behavior as you describe - progress and an empty 'mms.exe' window. When I type just 'cmd' it works.

ps - OS used is Windows 7 32 bit.