FeaturedPower ShellScripts

Copy Log files from remote machine

Use this script to copy log file from a remote machine and save it locally

$device = Get-Content -Path "C:\clients logs\pingableMachine.txt"

foreach ($remote in $device){

    if(test-path  -Path "\\$remote\c$"){
        write-host "the machine $remote is online" -foregroundcolor Green

        write-host "######  Copying LocationServices to c:\clients logs     ##########" -foregroundcolor Green
        copy-item -path "\\$remote\c$\windows\ccm\logs\locationServices.log" -Destination "C:\clients logs\$remote-locationServices.log"
        
    }

}

 

Show More

Related Articles

Back to top button