If you do not have Robocopy installed you will need to download and install it such as
-Windows 2003 Resource Kit Tools for a 2003 server or HomeServer
Next you need to install powershell 2.0 on the server you are using:
Next you need to allow unsigned scripts to do this:
C:\powershell.exe set-ExecutionPolicy unrestricted
To verify you can view the setting
You then should copy or create your batch files and/or scripts that are easily modified
robocopy source destination /MIR /r:3 /w:1
dir destination > scripts location
here is an example:
robocopy e:\ f:\ /MIR /r:3 /w:1
here is an example of the RoboCopyEmail.ps1 script I use:
## Define the variables for smtp server, from address, to address, subject and message body
$emailFrom = "firstname.lastname@example.org"
$emailTo = "email@example.com"
$subject = "Backup Mirroring Operation Complete"
$body = "Please confirm file dates below if no information below copy may not have completed properly"
$body = $body + "`r`n`r`n`r`n"
$body = $body + [string]::join([environment]::NewLine,(get-content c:\Scripts\DriveCopy.txt))
$smtpServer = "192.168.3.10"
## Initiate sending a message to the IT group.
$smtp = new-object Net.Mail.SmtpClient($smtpServer)
$smtp.Send($emailFrom, $emailTo, $subject, $body)
Shared credit: Tim Lewis, Daryl Hunter