我收到此错误: 图片
当我尝试运行此代码时:
strComputer = "server01"
strCommand = "powershell.exe -NoLogo -Command Start-Service -InputObject $(Get-Service -Computer " & strComputer & " -Name " & strService & ")"
Set WshShell = WScript.CreateObject("WScript.Shell")
Set objExec = WshShell.Run(strCommand,0,True)
我想在隐藏窗口中运行 strCommand 。这可以使代码运行并执行它应该执行的操作,但是会发生此错误,这真的很糟糕。