Super User is a question and answer site for computer enthusiasts and power users. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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-... – user127350 Apr 13 '12 at 21:37
    
Did you use one of the following commands? Set-ExecutionPolicy RemoteSigned or Set-ExecutionPolicy Unrestricted. – user127350 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 – user127350 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/… – user127350 Apr 13 '12 at 21:57

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

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .