Psexec命令运行带参数的powershell脚本
我正在尝试在TFS2017中的远程计算机上使用psexec运行powershell脚本,因为出于安全目的,已使用以下脚本禁用powershell远程处理和/或WMI。但我还需要将一些参数传递给我的powershell脚本。我已在环境的“配置变量”部分中定义了这些参数值。不确定如何将参数传递给psexec中的powershell脚本Psexec命令运行带参数的powershell脚本,powershell,parameter-passing,powershell-3.0,psexec,Powershell,Parameter Passing,Powershell 3.0,Psexec,我正在尝试在TFS2017中的远程计算机上使用psexec运行powershell脚本,因为出于安全目的,已使用以下脚本禁用powershell远程处理和/或WMI。但我还需要将一些参数传递给我的powershell脚本。我已在环境的“配置变量”部分中定义了这些参数值。不确定如何将参数传递给psexec中的powershell脚本 psexec \\computername cmd /c "Powershell.exe D:\script.ps1 -arg $(arg) -arg2 $(arg2
psexec \\computername cmd /c "Powershell.exe D:\script.ps1 -arg $(arg) -arg2 $(arg2) -arg3 $(arg3)"
但这不起作用。任何帮助都将不胜感激。我使用类似的东西。没什么不同,但是有一个旁路,我在脚本路径之前声明了-file
psexec \\$computername /s cmd /c %SystemRoot%\system32\WindowsPowerShell\v1.0\powershell.exe -ExecutionPolicy Bypass -file c:\path\script.ps1 -parameter1 $blah -parameter2 $blahblah
我用这样的东西。没什么不同,但是有一个旁路,我在脚本路径之前声明了-file
psexec \\$computername /s cmd /c %SystemRoot%\system32\WindowsPowerShell\v1.0\powershell.exe -ExecutionPolicy Bypass -file c:\path\script.ps1 -parameter1 $blah -parameter2 $blahblah