在 Win 7 環境,第一次執行 PowerShell 程式時,遇到下列運行錯誤: 
 Get-PowerShellRequirements.ps1 檔案無法載入,因為這個系統上已停用指令碼執行。如需詳細資訊,請參閱 "get-help about_signing"。 
At line:0 char:0
 
運行 get-help about_signing 指令後,得知 Windows PowerShell 執行原則的預設值 Restricted,也就是在這原則下,系統是不會允許任何指令碼執行。 
所以要修改它的執行原則設定值。 
用下列命令將電腦的執行原則變更為 RemoteSigned: 
    set-executionpolicy remotesigned
 
不過,沒想到執行 set-executionpolicy remotesigned 指令後,又遇到另外一個錯誤訊息: 
    Set-ExecutionPolicy : 拒絕存取登錄機碼 'HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\PowerShell\1\ShellIds\Microsoft.PowerShell'。 
    位於 行:1 字元:20 
    + set-executionpolicy <<<<  remotesigned
        + CategoryInfo          : NotSpecified: (:) [Set-ExecutionPolicy], UnauthorizedAccessException 
        + FullyQualifiedErrorId : System.UnauthorizedAccessException,Microsoft.PowerShell.Commands.SetExecutionPolicyCommand
 
原來是電腦的註冊機碼,無法正常被修正;這時只好已手工方式來調整。 
開始/執行/RegEdit,在 [HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\PowerShell\1\ShellIds\Microsoft.PowerShell] 處,新增一個機碼 ExecutionPolicy,機碼值為 RemoteSigned。
你也可以把下列指令,寫成 ps1-RemoteSigned.reg 檔案 (文字檔格式),再執行之,以便直接匯入機碼值。
ps1-RemoteSigned.reg
 Windows Registry Editor Version 5.00
 [HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\PowerShell\1\ShellIds\Microsoft.PowerShell]
"Path"="C:\\Windows\\System32\\WindowsPowerShell\\v1.0\\powershell.exe" 
"ExecutionPolicy"="RemoteSigned"
 
因為 set-executionpolicy 有多種設定選項:Restricted、AllSigned、RemoteSigned、Unrestricted, 
為了日後使用上的方便,可以先行建制好相關的註冊檔,如: 
ps1-Restricted.reg、ps1-AllSigned.reg、ps1-RemoteSigned.reg、ps1-Unrestricted.reg 
只要將註冊檔中的機碼值,改成和註冊檔名一樣的文字即可。 
例如:ps1-Restricted.reg 它的機碼值,就是 Restricted。
ps1- Restricted.reg
 Windows Registry Editor Version 5.00
 [HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\PowerShell\1\ShellIds\Microsoft.PowerShell] 
"Path"="C:\\Windows\\System32\\WindowsPowerShell\\v1.0\\powershell.exe" 
"ExecutionPolicy"=" Restricted"