以下サイトにある実行ポリシーをすべて実行
https://learn.microsoft.com/ja-jp/powershell/module/microsoft.powershell.core/about/about_execution_policies?view=powershell-7.4
以下、AllSigned、Bypass、Default、RemoteSigned、Restricted、Undefined、Unrestrictedを実行してみる
PS C:\Users\(現在のユーザ)\Desktop\共有フォルダ> Set-ExecutionPolicy -Scope CurrentUser AllSigned
PS C:\Users\(現在のユーザ)\Desktop\共有フォルダ> .\password.ps1
.\password.ps1: File C:\Users\(現在のユーザ)\Desktop\共有フォルダ\password.ps1 cannot be loaded. The file C:\Users\(現在のユーザ)\Desktop\共有フォルダ\password.ps1 is not digitally signed. You cannot run this script on the current system. For more information about running scripts and setting execution policy, see about_Execution_Policies at https://go.microsoft.com/fwlink/?LinkID=135170.
PS C:\Users\(現在のユーザ)\Desktop\共有フォルダ> Set-ExecutionPolicy -Scope CurrentUser Bypass
PS C:\Users\(現在のユーザ)\Desktop\共有フォルダ> .\password.ps1
PS C:\Users\(現在のユーザ)\Desktop\共有フォルダ>
PS C:\Users\(現在のユーザ)\Desktop\共有フォルダ> Set-ExecutionPolicy -Scope CurrentUser Default
PS C:\Users\(現在のユーザ)\Desktop\共有フォルダ> .\password.ps1
.\password.ps1: File C:\Users\(現在のユーザ)\Desktop\共有フォルダ\password.ps1 cannot be loaded because running scripts is disabled on this system. For more information, see about_Execution_Policies at https://go.microsoft.com/fwlink/?LinkID=135170.
PS C:\Users\(現在のユーザ)\Desktop\共有フォルダ> Set-ExecutionPolicy -Scope CurrentUser RemoteSigned
PS C:\Users\(現在のユーザ)\Desktop\共有フォルダ> .\password.ps1
PS C:\Users\(現在のユーザ)\Desktop\共有フォルダ>
PS C:\Users\(現在のユーザ)\Desktop\共有フォルダ> Set-ExecutionPolicy -Scope CurrentUser Restricted
PS C:\Users\(現在のユーザ)\Desktop\共有フォルダ> .\password.ps1
.\password.ps1: File C:\Users\(現在のユーザ)\Desktop\共有フォルダ\password.ps1 cannot be loaded because running scripts is disabled on this system. For more information, see about_Execution_Policies at https://go.microsoft.com/fwlink/?LinkID=135170.
PS C:\Users\(現在のユーザ)\Desktop\共有フォルダ> Set-ExecutionPolicy -Scope CurrentUser Undefined
PS C:\Users\(現在のユーザ)\Desktop\共有フォルダ> .\password.ps1
PS C:\Users\(現在のユーザ)\Desktop\共有フォルダ>
PS C:\Users\(現在のユーザ)\Desktop\共有フォルダ> Set-ExecutionPolicy -Scope CurrentUser Unrestricted
PS C:\Users\(現在のユーザ)\Desktop\共有フォルダ> .\password.ps1
PS C:\Users\(現在のユーザ)\Desktop\共有フォルダ>