Copy a local file to remote(s) computer(s).

#as a test i copy 7zip installer remotely,run the .exe there and make sure it is running

$servernames = Get-Content <Path>
$Session = New-PSSession -ComputerName $servernames
Copy-Item <Path> -Destination <Path> -ToSession $Session -Recurse
Invoke-Command -Session $Session -ScriptBlock {Start-Process c:\received\7z1900-x64.exe;Get-Process -Name *7*}

#make sure to remove-pssession when done

Leave a Reply

Your email address will not be published. Required fields are marked *