Answer the question
In order to leave comments, you need to log in
What to add to the script so that it remotely copies the exe to multiple hosts?
Good day!
It is not possible to copy exe via Invoke-Command to many hosts, there is nothing intelligible in Google.
Created a shared folder on the domain controller, placed the exe-shnik there.
Here is the
Set-Item wsman script itself:\localhost\client\trustedhosts * -Force;
$pc= (Get-ADComputer -Filter * -Property *|Select-Object Name).Name;
$dest = '\\WIN-4HCHDV7O78U\fusion'
$path = 'C:\fusion\GLPI_autoinstall.exe'
foreach($pc in $pcs)
Invoke-Command -ScriptBlock {Start-Process PowerShell -wait -verb open -ArgumentList 'Copy-Item -Path \\WIN\c$\fusion\GLPI_autoinstall.exe -Destination \\$pc\$path\'} -ComputerName $pc;
Invoke-Command -ScriptBlock {cmd /c ″C:\fusion\GLPI_autoinstall.exe″} -ComputerName $pc;
What needs to be corrected/removed for the script to work?
Thank you
Answer the question
In order to leave comments, you need to log in
Regardless of what's in the script.
If you are copying from the network inside the invoke-command - you get the classic double-hop == access
denied
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question