Elwin_Wang

  博客园  :: 首页  :: 新随笔  :: 联系 :: 订阅 订阅  :: 管理

PowerShell Excution Policy and Redirection

 

如果在执行ps1脚本时,报如下错误:

.ps1 cannot be loaded because the execution of scripts is disabled on this system

解决方法:

Set-ExecutionPolicy RemoteSigned

Set-ExecutionPolicy Unrestricted

 

About PowerShell Excution Policy:

https://docs.microsoft.com/en-us/powershell/module/microsoft.powershell.core/about/about_execution_policies?view=powershell-5.1

 

 

We can redirect info to a log file like this:  powershell.exe test.ps1 > logfile.txt

About PowerShell redirection:

https://docs.microsoft.com/en-us/powershell/module/microsoft.powershell.core/about/about_redirection?view=powershell-7

posted on 2020-11-10 10:04  Elwin_Wang  阅读(109)  评论(0)    收藏  举报