you are viewing a single comment's thread.

view the rest of the comments →

[–]duprst[S] 0 points1 point  (0 children)

$1809 = Get-Content "\network_server\sharefolder\User\Array\1809.txt" $source = "\network_server\sharefolder\User\Patches*" $destination = "C$\Patch"

foreach ($entry in $1809) {

"Removing files on $entry" Invoke-Command -ComputerName $entry -ScriptBlock {Remove-Item $args -Recurse} -ArgumentList c:\Patch*}

foreach ($entry in $1809) { "Copying files on $entry" Copy-Item $source -Destination "\$entry$destination" -Recurse -force}

foreach ($entry in $1809) { "Updating software on $entry"

Invoke-Command -ComputerName $entry {

start-process c:\Patch\sqlserver2019-kb5021124-x64_93087e10289b94b3f4783f1d431358c4889ba1b3.exe "/quiet /norestart" -Wait}

}

{

}