I just loaded PowerShell and VI Toolkit on my new laptop and I am getting the following security error "snapshot.ps1 cannot be loaded because the execution of scripts is disabled on
this system." What security permission or policy do i have to modify to correct this problem?
Hi,
The Set-ExecutionPolicy changes the user preference for the execution policy of the shell. The execution policy is part of the security strategy of Windows PowerShell. It determines whether you can load configuration files (including your Windows PowerShell profile) and run scripts, and it determines which scripts, if any, must be digitally signed before they will run.
You need to set the executionpolicy to unrestricted using the below cmdlet
set-executionpolicy unrestricted
get-executionpolicy will return the current executionpolicy.
Thanks
Niket
Hi,
The Set-ExecutionPolicy changes the user preference for the execution policy of the shell. The execution policy is part of the security strategy of Windows PowerShell. It determines whether you can load configuration files (including your Windows PowerShell profile) and run scripts, and it determines which scripts, if any, must be digitally signed before they will run.
You need to set the executionpolicy to unrestricted using the below cmdlet
set-executionpolicy unrestricted
get-executionpolicy will return the current executionpolicy.
Thanks
Niket
Awesome, that works thanks
Default ExecutionPolicy is Restricted. Unrestricted is unnecessarily risky. Set-ExecutionPolicy RemoteSigned is more secure and works for VI Toolkit 1.5.
I have to edit the wirte permission in REGEDIT to funtion the command, otherwise it was keeping remind you:
Set-ExecutionPolicy : Access to the registry key 'HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\PowerShell\1\ShellIds\Microsoft.PowerShell' is denied.
You're not running the PowerShell session "as an administrator" and then UAC will not allow you to change a HKLM registry entry.
See this Execution Policy and Vista post for the reasoning behind this..
Blog: lucd.info Twitter: @LucD22 Co-author PowerCLI Reference