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

Azure MFA with Azure AD and RDS

Failed to setup initiator portal. Error status is given in the dump data.

Invalid pointer on gpresult /h gpreport.html