我正在尝试使用Powershell远程安装Chocolatey和Choco包。我可以使用以下命令远程安装Chocolatey而没有问题(我的txt文件只包含一台服务器):
$ComputerList = "C:\temp\DataDogServers.txt"
$Computers = Get-Content -Path $ComputerList
Invoke-Command -ComputerName $Computers -ScriptBlock {
Set-ExecutionPolicy Bypass -Scope Process -Force; [System.Net.ServicePointManager]::SecurityProtocol = [System.Net.ServicePointManager]::SecurityProtocol -bor 3072; iex ((New-Object System.Net.WebClient).DownloadString('https://chocolatey.org/install.ps1'))
}然后,当我尝试执行远程choco命令时,它返回了我确认在远程服务器上运行choco正常工作的The term 'choco' is not recognized as the name of a cmdlet, function, script file, or operable program.。
发布于 2020-09-03 02:22:44
它可能已安装,但未更新当前会话的路径。使用choco.exe的完全限定路径,或者更新/重新加载path环境变量。
https://stackoverflow.com/questions/63711355
复制相似问题