i challenged a coworker to put his powershell class to good use and come up with a script that would actually have an impact, albeit little, to his day-to-day administrative work. he came up with a little script that would dump repadmin output to a text file and mail him an attachment. here’s the script: %{repadmin /replsum * /bysrc /bydest} > logfile.txt $filename = “logfile.txt” $smtpServer = “mysmtp.mydomain.com” $msg = new-object Net.Mail.MailMessage $attachment = new-object Net.Mail.Attachment($filename) $smtp = new-object Net.Mail.SmtpClient($smtpServer) $msg.From = “myemail@mydomain.com” $msg.To.Add(”myemail@mydomain.com”) $msg.Subject = “Repadmin Report ” + [System.DateTime]::Now $msg.Body = “The daily Repadmin log file is attached” $msg.Attachments.Add($attachment) $smtp.Send($msg) this is okay, but opening that attachment every time would be irritating… so i thought it might be easier just to get the output into a variable and write it to the body of the
notes, ramblings, contemplations, transmutations, and otherwise ... on management and directory miscellanea.