googlemad Posted February 27, 2023 Posted February 27, 2023 Long story cut short, we have a script which essentially does a Robocopy of some patient PDFs from a folder on the server to several PCs I've just included the most relevant parts of the script below #Loop through wards and process those in the list $wardList = $param.SelectNodes("//wards/ward") # XPath is case sensitive foreach ($ward in $wardList) { $wardName = $ward.getAttribute("name") if ($folderName -eq 'ALL' -or $foldername -Contains $wardName) { $DestinationFolder = $ward.getAttribute("target") $SourceFolder = $Charts + '\' + $wardName $log = $ward.getAttribute("log") $Logfile = $Logs + '\' + $wardName + $(if($log -ne '') {'_' + $log}) + '.log' # Copy Folder with Robocopy Write-Host "Synchronising $SourceFolder with $DestinationFolder writing $Logfile" Robocopy $SourceFolder $DestinationFolder /MIR /R:1 /W:5 /Z /LOG:$Logfile /NP Another XML has a ward list defined e.g. If PC123 and PC345 are both online when the script attempts to run, great! They both get the files If PC123 is online but PC345 is offline then PC123 will get the files but PC345 won't However if PC123 is offline but PC345 is online then the script seems to give up after finding PC123 is offline and PC345 never gets the files as a result Is there a simple fix other than telling the users that the particular PCs should never be turned off which we must have told them about 100 times now and they still turn them off anyway!
andy_b Posted February 27, 2023 Posted February 27, 2023 Intially I was thinking about WOL and get the script to turn the computers on. Then maybe thinking you could use "Test-Connection PC345 -quiet" to check if the PC was online before trying the robocopy to that machine. But potentially this could mean the PC becomes "out of sync". Would it not be better if the PC itself pulled the latest versions of the files? Then if it is off, it can update itself immediately when next turned on?
chaplic Posted February 27, 2023 Posted February 27, 2023 Group Policy Preferences can be configured to copy files to laptop Also, robocopy in powershell is a bit odd with arguments. Are you SURE your R:1 and W:5 is being respected?
googlemad Posted February 27, 2023 Author Posted February 27, 2023 Thanks for the suggestions In the end I decided to just ditch the script and install FreeFileSync on the server and set up all my sync locations on there which works perfectly as a scheduled task running every 10 minutes and is about a million times faster at getting the job done too
SenseiForlan Posted January 20, 2024 Posted January 20, 2024 (edited) Thanks for the suggestions In the end I decided to just ditch the script and install FreeFileSync on the server and set up all my sync locations on there which works perfectly as a scheduled task running every 10 minutes and is about a million times faster at getting the job done too FreeFileSync is a good choice , try and feed back . Edited January 20, 2024 by SenseiForlan
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now