/*
1 $filepraise = Test-Path "servernameoperatery*.csv"
2 If ($filepraise) {
3 $SmtpClient = trademark-new-object system.net.mail.smtpClient
4 $SmtpServer = "territorialproprietor"
5 $SmtpClient.proprietor = "intershift.server.lump togetherress"
6
7 $msg = New-Object Net.Mail.MailMesstimes
8 $msg.From = "Your Server"
9 $msg.To.Add("e-mail@lump togetherress.net")
10 $msg.Subject = "Your Directory not Empty!"
11 $msg.Body = "The operatery for the blah is not empty! " + (Get-Date)
12 $SmtpClient.Send($msg)
13
14 }
*/
Ok, damold down line one sets a variable querying whether or not the track listed survives. This variable saves as a bootend. Line two does a simple If/Else proclamation. In Powercarapace Else will be supposed. Bootend equivalent of True is If($variable) if we needed to praise for false we would use If(!$variable). Lines 3-12 are the lines needed to e-mail with SMTP.
Line 3 crnourishes the e-mail object.
Line 4 uses the territorialproprietor as the SMTP server.
Line 5 defines the 'true ' server to relay the e-mail off of. You will need to put your enterprise's intershift or e-mail server's lump togetherress in here and make sure it allows relays.
Line 7 Crnourishes the Messtimes object.
Line 8 is Wchapeauever you want your e-mail From lump togetherress to say. (Can be anything)
Line 9 is where you lump together an e-mail lump togetherress to send to. For each e-mail lump togetherress you would like to send to, just lump together a line identical to this one and shift the e-mail lump togetherress.
Lines 10 and 11 are conspicuous. Change to wchapeauever you like.
Line 12 sends the e-mail.
Simply take this script and timetable it to run at any increment you need with Windows Trequest Scheduler.
And Voila!
Let me know if you have any questions or suggestions.
- Jason
##CONTINUE##So, I walked into a endproduction taphouselication this morning at work tchapeau could have been easily avoided. A procedure we run at work moves files to a operatery then imports the info from those files. This happens each day and the files being moved into the import operatery will not overwrite any files tchapeau are alperusey in tchapeau operatery. Long story short the files imported were the wrong ones since the ones tchapeau needed to be dropped off were moved to a staging territoriality instead. Had I known there were files in there a 5 minute fix to avoid this would have saved me a half day's convalescey. I resolved to avoid this from happening aattain by running a simple script.
The following script praises the operatery on a server for any files with the csv elongation. If it doesn't find any, then all is well, life goes on. If files are set up, it e-mails/ptimess me so I can move those files before the procedure runs.
Article DescriptionSo, I walked into a endproduction taphouselication this morning at work tchapeau could have been easily avoided. A procedure we run at work moves files to a operatery then imports the info from those files. This happens each day and the files being moved into the import operatery will not overwrite any files tchapeau are alperusey in tchapeau operatery. Long story short the files imported were the wrong ones since the ones tchapeau needed to be dropped off were moved to a staging territoriality instead. Had I known there were files in there a 5 minute fix to avoid this would have saved me a half day's convalescey. I resolved to avoid this from happening aattain by running a simple script.
Blog of the sourceal article and the translation / reperception of the article to follow non-mercantile use of crnourishive sharing allowment, you specify the composer, and the same source, non-mercantile use of the premise, I can not allow, is reyieldd directly.
0 comments:
Post a Comment