![]() Installed by: $UserID" -Subject $Subject -Credential $Cred -Encoding $encoding Send-MailMessage -From $From -To $To -SmtpServer $Server -Body "$Body. $Body=Get-WinEvent -FilterHashtable | Select TimeCreated,Message | select-object -First 1 ![]() #Generates email body containing time created and message of application install. $UserSID = (Get-WinEvent -FilterHashtable | select -First 1 #Generates human readable userID from UserSID in log. $encoding = ::UTF8 #Setting encoding to UTF8 for message correct display $Cred = New-Object, $Pwd) #Sender account credentials #(Warning! Use a very restricted account for the sender, because the password stored in the script will be not encrypted) $Pwd = ConvertTo-SecureString "enterpassword" -AsPlainText –Force #Sender account password $From = # From whom we are sending an e-mail(add anonymous logon permission if needed) $Subject = "New Software Has Been Installed on $env:COMPUTERNAME" # Message Subject
0 Comments
Leave a Reply. |
Details
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |