Posts

Showing posts from June, 2023

Script to copy package to a remote machine and execute it

 # Define variables $computers = "Device","machine","machine","machine3" $sourcePath = "C:\Users\username\Desktop\Client" # source path # Copy the file to each remote computer foreach ($computer in $computers) {     Copy-Item -Path $sourcePath -Destination "\\$computer\C$\temp" -Recurse } # Install the software on each remote computer foreach ($computer in $computers) {     $process = [WMICLASS]"\\$computer\ROOT\CIMV2:Win32_Process"     $process.Create("C:\Temp\Client\Client_upgrade.bat") # cmd line here with path where it has been copied  }