是否有执行策略的解决方法?
PS C:UsersthufirDesktop>
PS C:UsersthufirDesktop> .stock.ps1
.stock.ps1 : File C:UsersthufirDesktopstock.ps1 cannot be loaded because running scripts is disabled on this
system. For more information, see about_Execution_Policies at http://go.microsoft.com/fwlink/?LinkID=135170.
At line:1 char:1
+ .stock.ps1
+ ~~~~~~~~~~~
+ CategoryInfo : SecurityError: (:) [], PSSecurityException
+ FullyQualifiedErrorId : UnauthorizedAccess
PS C:UsersthufirDesktop>
我只是想找到带有脚本的股票报价。是的,您可以/有点运行带有复制/糊的脚本,但是...没有更好的东西吗?
策略为:
PS C:UsersthufirDesktop>
PS C:UsersthufirDesktop> Get-ExecutionPolicy -List
Scope ExecutionPolicy
----- ---------------
MachinePolicy Undefined
UserPolicy Undefined
Process Undefined
CurrentUser Undefined
LocalMachine Undefined
PS C:UsersthufirDesktop>
(不是我的机器。(
我正在寻找这个问题的反面。
构建Bill_stewart的评论,创建一个具有以下目标的快捷方式,它将允许您运行一个PowerShell脚本:
C:WindowsSystem32WindowsPowerShellv1.0powershell.exe -executionpolicy bypass -file "\ServerPathtoscriptscript.ps1"
如果要在远程计算机上运行此命令,则可以在创建上述快捷方式并将其存储在远程计算机上可以访问网络的某个地方。
。Invoke-Command -computername Computer1 -Scriptblock { Start-process "\ServerPathtoshortcutshortcut.lnk" }