The script: http://pastebin.com/SBTt5gKV
Seems like every day I find a further use for Powershell. I have a number of robocopy jobs floating around my environment. For the most part, they work really well. When they don't, however, they tend to fail like a tree in the woods with no one around. You could very easily modify this to pull exit codes from any process and create log entries based on them.
Powershell to the rescue! With powershell, I created a custom event log in Event Viewer, and then set up a script to write the exit code of the robocopy job to this log. This brings it on the radar of my Splunk server, and helps me maintain confidence that my jobs are working correctly.
Note that before you start using this script, you'll need to execute the following command to create the associated log:
New-EventLog -LogName "Robocopy Scripts" -Source Robocopy
Your optimization and ideas are appreciated.
[link] [3 comments]