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

Generating Event ID 91, 44 with CA (In Event Viewer with source as Certsvc)

Group policy default policy cannot be edited because network name not found

Problem when changing update source