Answers for "powershell copy folder to remote computer"

0

powershell copy folder to remote computer

# The following array contains the destination servers
$computers = @("SRV1","SRV2","SRV3")
 
# This is the file/folder(s) you want to copy to the servers in the $computer variable
$source = "C:\Software\EMC\Networker\NWVSS.exe"
 
# The destination location you want the file/folder(s) to be copied to
$destination = "C$\temp\"
 
foreach ($computer in $computers) {
if ((Test-Path -Path \\$computer\$destination)) {
Copy-Item $source -Destination \\$computer\$destination -Recurse
} else {
"\\$computer\$destination is not reachable or does not exist"
}
}
Posted by: Guest on August-19-2021
0

powershell copy folder to remote computer

Start-Transcript -path 'c:\scriptlog.txt'
$ServerList         = import-csv 'C:\powershell\Workstation-test.CSV'
$SourceFileLocation = 'C:\Niche'
$Destination        = 'C$\Niche'
 
foreach ($_ in $ServerList.computer){
    remove-item "\\$_\$Destination" -Recurse -Force -Verbose
    Copy-Item $SourceFileLocation -Destination "\\$_\$Destination" -Recurse -Verbose
}
Stop-Transcript
Posted by: Guest on August-19-2021

Code answers related to "powershell copy folder to remote computer"

Code answers related to "Shell/Bash"

Browse Popular Code Answers by Language