PowerCLI: "Security Warning. Run only scripts that you trust."

Actually, this is an issue with PowerShell and not PowerCLI. When a script is downloaded via Internet Explorer from the Internet or an Intranet, a NTFS Alternative Data Stream is added to the file with a Zone Identifier, indicating the file’s origin. These scripts are unsigned, and thus untrusted.

PowerCLI C:\vCheck-vSphere-master> .\vCheck.ps1
Security Warning
Run only scripts that you trust. While scripts from the Internet can be useful, this script can potentially harm your computer. Do you want to run
C:\vCheck-vSphere-master\Styles\Default\Style.ps1?
[D] Do not run  [R] Run once  [S] Suspend  [?] Help (default is "D"): D

To resolve this, Right-click on PowerCLI > Run as Administrator:

PowerCLI C:\> Get-ExecutionPolicy
Unrestricted
PowerCLI C:\> Set-ExecutionPolicy bypass
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

References

Leave a Reply

Your email address will not be published. Required fields are marked *