Oracle 74 Posted August 7, 2022 Share Posted August 7, 2022 I wrote this today, and seems to do the trick. I've been playing a lot with PowerShell recently and am looking for any feedback, or additional tricks/tools I can use to refine this script. Ideally, it would be nice to have a 1-1 sync between source and destination, but robocopy won't allow that. But, for the time being, this'll do! You all are welcome to it, as well! server_backup_test.ps1 1 Link to comment Share on other sites More sharing options...
justinrh 174 Posted August 7, 2022 Share Posted August 7, 2022 Simple and clean. Why did you choose RoboCopy instead of Copy-Item? I'd suggest some status output like "now copying Movies". Why are you clearing the screen between copies? Sometimes it is nice to keep the output in case there is an error or other unexpected msg. To be more PowerShelly, replace pause with Read-Host "put prompt here". Now you need to put in some error management - the fun part! Logging? Link to comment Share on other sites More sharing options...
Oracle 74 Posted August 8, 2022 Author Share Posted August 8, 2022 11 hours ago, justinrh said: Simple and clean. Why did you choose RoboCopy instead of Copy-Item? I'd suggest some status output like "now copying Movies". Why are you clearing the screen between copies? Sometimes it is nice to keep the output in case there is an error or other unexpected msg. To be more PowerShelly, replace pause with Read-Host "put prompt here". Now you need to put in some error management - the fun part! Logging? Ha, I chose RoboCopy instead of Copy-Item, because I am rather unfamiliar with the function of Copy-Item and had a pre-existing script written using Robocopy that I used previously. What would syntax look like for Copy-Item? Link to comment Share on other sites More sharing options...
justinrh 174 Posted August 8, 2022 Share Posted August 8, 2022 Copy-Item (Microsoft.PowerShell.Management) - PowerShell | Microsoft Docs PowerShell Copy Item examples - SPGuides Link to comment Share on other sites More sharing options...
Oracle 74 Posted August 9, 2022 Author Share Posted August 9, 2022 Thanks, mate! Link to comment Share on other sites More sharing options...
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