Hyper-V 2008 Powershell Security Warnings

After setting the execution policy for windows powershell to unrestricted, you still are unable to run powershell scripts from a batch file or the command line without the following warning popping up:

C:\MyScripts> Set-ExecutionPolicy unrestricted
PS C:\MyScripts> ./somefile.ps1
Security Warning
Run only scripts that you trust. While scripts from the Internet can be usefull they can also be used to damage your computer.
Do you want to run C:\MyScripts\somefile.ps1?
[D] Do not run [R] Run once [S] Suspend [?] Help (default is "D"):

This is the default warning for scripts that originate from the internet. You can check and change the zone by doing the following:

  • notepad somefile.ps1:Zone.Identifier
  • Change the ZoneId to 0 and save the file.