Tuesday, 18 October 2011
File cannot be loaded because the execution of scripts is disabled on this system error in PowerShell
File cannot be loaded because the execution of scripts is disabled on this system error in PowerShell
Open Powershell as administrator and type
Get-ExectionPolicy
An overview of the policy levels:
Restricted: Individual cmdlets can run, but not saved Powershell scripts. This is the default setting.
AllSigned: Scripts can run, but must have a digital signature even if written on the local computer. Prompts you before running scripts from trusted publishers.
RemoteSigned: Scripts written on the local computer do not need a digital signature, but any script downloaded from outside (email, IM, Internet) must have a signature to execute.
Unrestricted: Any script can run, but scripts downloaded from outside will run with a warning.
By default its set to Restricted
To change it type
Set-ExecutionPolicy Unrestricted
To run a script from a batch file
runas /user:AISCT\administrator "powershell.exe -noexit e:\newdomain.ps1"
My ps script
Set-Restrictionpolicy Unrestricted
Add-Computer -DomainName AISCT -cred AISCT\administrator
Subscribe to:
Post Comments (Atom)
I was not aware of this settings of level of restriction or security.I was wondering how to change it.Thanks for writing a detailed post on same and helping me.
ReplyDeletePDF signature