0

我在我的电脑上运行脚本很好。它崩溃了,我得到了一个新的,我不断收到这个错误。(文件 C:\Users\19257\Desktop\DriveMaps.ps1 无法加载,因为在此系统上禁用了运行脚本。)所以,我知道脚本是否良好。它在其他人的计算机上运行。

我尝试过的。

  1. 已验证我的 PC 在正确的 AD OU 中。与其他可以运行脚本的人一样。
  2. 我以管理员身份运行 PowerShell 并尝试了这些命令并得到相同的错误。
  • Set-ExecutionPolicy RemoteSigned
  • Set-ExecutionPolicy -Scope CurrentUser -ExecutionPolicy Unrestricted
  • Set-ExecutionPolicy -ExecutionPolicy RemoteSigned -Scope LocalMachine
  1. 我的设置目前是这样的:
Scope ExecutionPolicy
----- ---------------
MachinePolicy       Undefined
   UserPolicy       Undefined
      Process       Undefined
  CurrentUser       Undefined
 LocalMachine       Undefined
4

1 回答 1

-2

我想到了。而不是以管理员身份在 PowerShell 中运行 Set-ExecutionPolicy RemoteSigned。我以管理员身份在 PowerShell ISE 中运行它,它工作正常!

于 2020-12-23T14:59:13.887 回答