我创建了一个ruby脚本来打开Powershell并运行我在其中创建的模块,以下命令是我用来做这个的;
cmd /c C:\\NaviMedix\\Shared\\Bin\\psexec -s C:\\Windows\\System32\\WindowsPowerShell\\v1.0\\powershell.exe C:\\HTTP\\loadServerManager.ps1
在我自己的VM中本地运行时它正常工作并给我以下输出。虽然当我将它作为库存储在食谱中并通过Run Deck运行时,它给了我不同的输出。
本地输出:
PsExec v1.86 - Execute processes remotely
Copyright (C) 2001-2007 Mark Russinovich
Sysinternals - www.sysinternals.com
Starting C:\Windows\System32\WindowsPowerShell\v1.0\powershell.exe on SCSBCHEFTE
C:\Windows\System32\WindowsPowerShell\v1.0\powershell.exe exited on SCSBCHEFTEST04 with error code 0.
Welcome to Powershell augmented with NaviNet tools.
Directory: C:\Windows\system32\WindowsPowerShell\v1.0\Modules
ModuleType Version Name ExportedCommands
---------- ------- ---- ----------------
Manifest 2.0.0.0 AppLocker {Get- AppLockerFile...
Manifest 2.0.0.0 Appx {Add-AppxPackage, ...
Manifest 1.0 BestPractices {Get-BpaModel,
Success : True
RestartNeeded : No
FeatureResult : {}
ExitCode : NoChangeNeeded
Name : NET-HTTP-Activation
DisplayName : HTTP Activation
Description : HTTP Activation supports process activation via
HTTP. Applications that use HTTP Activation can
start and stop dynamically in response to work
items that arrive over the network via HTTP.
Installed : True
InstallState : Installed
运行Deck输出:
PsExec v1.86 - Execute processes remotely
Copyright (C) 2001-2007 Mark Russinovich
Sysinternals - www.sysinternals.com
Connecting to local system...
Starting PsExec service on local system...
Connecting with PsExec service on SCSBCHEFTEST01...
Starting C:\Windows\System32\WindowsPowerShell\v1.0\powershell.exe on SCSBCHEFTEST01...
C:\Windows\System32\WindowsPowerShell\v1.0\powershell.exe exited on SCSBCHEFTEST01 with error code 1.
我希望本地输出出现在Run Deck输出中,但似乎无法使其正常工作。有人可以帮我解决这个问题吗?