send mail on script failure


hi friends,

i have simple script makes nw connection, copies files source destination & closes connection.

net use \\destinationpath\ipc$ "passwod" /user:domain\username
robocopy "sourcepath" "\\destinationpath" /mir /is
net use \\destinationpath\ipc$ /delete

idea email if above script fails in execution, advise please...


rgds, minesh

robocopy /?

/log:file : output status log file (overwrite existing log). /unilog:file : output status unicode log file (overwrite) ## 

to send mail use send-mailmessage -attachments( get-help send-mailmessage -full) :

send-mailmessage -attachment robocopylog.txt -to "user01 <user01@example.com>" -from "user02 <user02@example.com>" -subject "robocopy"



Windows Server  >  Windows PowerShell



Comments

Popular posts from this blog

WIMMount (HSM) causing cluster storage to go redirected (2012r2 DC)

Failed to delete the test record dcdiag-test-record in zone test.com

Azure MFA with Azure AD and RDS