Skip to main content

Powershell script Pre/Post commands not working!

Thread needs solution
Beginner
Posts: 2
Comments: 11

Hi,

Running Acronis True Image 2016 build 6571

I cannot use Powershell script no mather what exicuting policy. I still get the error message

"scriptname - cannot be load becaue running scripts is disabled on this system"

I can run scripts just fine. Signed or not. This is a problem with Acronis, please fix asap, thank you.

also, if Acronis is not setting a new variable %COMPUTER_NAME% the right one is %COMPUTERNAME% , %OPERATION_STATUS% returns nothing also =/

0 Users found this helpful
Legend
Posts: 73
Comments: 16442

Please see the document attached that I have used to successfully run powershell commands.

Attachment Size
370485-130942.pdf 75.75 KB
Beginner
Posts: 2
Comments: 11

Thanks but I should not have to use a batch file to launch a ps1 file

My execution policy is already set to RemoteSigned. And I've tried Unrestricted as well. Like I said, its an issue with Acronis. They don't check the current execution policy before the script is suppose to run. 

BTW, Instead of that

File 2: Test.CMD with contents:
powershell -command set-executionpolicy unrestricted
powershell -file "e:\test.ps1"
powershell -command set-executionpolicy default

you can use one command, 

  • powershell.exe -ExecutionPolicy ByPass -File e:\test.ps1

and that way you don't have to switch policy back and forth.

 

Legend
Posts: 73
Comments: 16442

Thanks for the tip about the powershell command, I have only barely touched using it but you could try sending a PM to MVP Karl Heinz who looks to have a lot more experience in this area (based on exchanges in the private MVP forums).

Beginner
Posts: 2
Comments: 11

I might do that, thanks! have a good midsummer?

Beginner
Posts: 0
Comments: 1

I know this thread is years old, but I got here from a google search so leaving this for others...

To run PowerShell script from Acronis without a batch script (tested with 2016 build 6595 on Windows 10 1803); in the custom command dialog:
Command: powershell.exe
Working directory: C:/Windows/System32/WindowsPowerShell/v1.0
Arguments: -ExecutionPolicy ByPass -File //<server>/<share>/<pathtopsfile>.ps1

Justin

Legend
Posts: 73
Comments: 16442

Justin, welcome to these public User Forums.

Thank you for sharing your findings on this topic.  I have found that you do not need to put the path to Powershell.exe in the Working directory box provided powershell runs Ok on your system. I have learnt about and use a lot more Powershell scripts since this topic was originally being discussed and now use this in preference to running older batch files.