Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

I am new to powershell and using 1.0version and am trying to write a powershell script that I can execute using autosys scheduler. When the I run the command in autosys

powershell -command "& { %MY_HOME%\bin\TestScript.ps1 argument; exit $LASTEXITCODE }"

it gives me the error

script cannot be loaded because the execution of scripts is disabled on this system. Please see "get-help about_signing" for more details.

I did set the executionpolicy to unrestricted from an admin user account. Not sure how I should execute this so my autosys job runs this powershell script. I have also tried using just quotes. but everytime I get this error.

Thanks

share|improve this question
    
Did you run the set-executionpolicy from a Powershell window opened with "run QA administrator"? Check your current lever with get-... –  Radoo Apr 13 '12 at 21:37
    
Did you use one of the following commands? Set-ExecutionPolicy RemoteSigned or Set-ExecutionPolicy Unrestricted. –  Radoo Apr 13 '12 at 21:47
    
If you are trying to run a remote command, on the remote computer you must set also WinRM by running Set-WSManQuickConfig –  Radoo Apr 13 '12 at 21:52
    
Offtopic: it would be great if you could upgrade to PowerShell 2 (actually on Win Server 2008 R2 it should be by default 2.0). Seems that removing is a PS 2 feature simple-talk.com/sysadmin/powershell/… –  Radoo Apr 13 '12 at 21:57

2 Answers 2

My guess is that those scripts are run under a different account than the one you changed the execution policy for. Try to change the policy for all users on the machine by using the -Scope parameter:

Set-ExecutionPolicy RemoteSigned -Scope LocalMachine
share|improve this answer
    
I'll try the scope, but am not sure if it is available in v1.0. –  psnewbie Apr 16 '12 at 13:37
    
This did not work as I am in v1.0 –  psnewbie Apr 16 '12 at 14:29

OOps, it's just a generic error, Google your error, you can find bundles of posts on the solution. This is just you havent enabled running Powershell scripts on your target machine.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.