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 

}

Comments

Popular posts from this blog

powershell script to export applications and its requirement in weird way

get-allrecent udpated logs

TASK sequence duration report