Skip to content

Instantly share code, notes, and snippets.

@idavis
Created May 16, 2011 20:50
Show Gist options
  • Save idavis/975346 to your computer and use it in GitHub Desktop.
Save idavis/975346 to your computer and use it in GitHub Desktop.
Executing scripts while script execution is disabled
PS C:\Development\PowerStudio> set-executionpolicy default
Execution Policy Change
The execution policy helps protect you from scripts that you do not trust. Changing the execution
policy might expose you to the security risks described in the about_Execution_Policies help topic.
Do you want to change the execution policy?
[Y] Yes [N] No [S] Suspend [?] Help (default is "Y"): Y
PS C:\Development\PowerStudio> type .\test.ps1
gci
PS C:\Development\PowerStudio> .\test.ps1
File C:\Development\PowerStudio\test.ps1 cannot be loaded because the execution of scripts is disab
led on this system. Please see "get-help about_signing" for more details.
At line:1 char:11
+ .\test.ps1 <<<<
+ CategoryInfo : NotSpecified: (:) [], PSSecurityException
+ FullyQualifiedErrorId : RuntimeException
PS C:\Development\PowerStudio> invoke-expression (type .\test.ps1)
Directory: C:\Development\PowerStudio
Mode LastWriteTime Length Name
---- ------------- ------ ----
d---- 4/5/2011 9:54 AM graphics
d---- 5/16/2011 9:48 AM release
d---- 5/3/2011 8:35 AM source
d---- 5/16/2011 8:43 AM tools
...
...
PS C:\Development\PowerStudio>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment