Hi Guys need some help,
I have a old Windows 2012 Server, and we have AD installed in it... my question is how will i configure Email Alert on it if the server go down due to a Power outage? we don't have UPS installed for the server as well. is there any way or a PowerShell we can have to trigger this as I know in windows 2012 email alerts are depreciated.
CodePudding user response:
On the server create a scheduled task that executes on boot. This task can send an email after every server restart.
The Windows Event log will contain events with ID 6008 (which means "The previous system shutdown at time on date was unexpected") - ie power-cut or other unplanned shutdown. You might also be interested in event id 1074 which is "System has been shutdown by a process/user" ie a normal reboot/shutdown. You can retrieve events from the event log with Powershell using Get-EventLog
Edit:
You should be able to use Send-MailMessage
to send email from powershell 3 on server 2012 - but you will need an SMTP server that will accept unencrypted traffic (which is a separate problem).
Server 2012 is old and approaching end of support, but its already in extended support - this means no new features are getting added. This includes adding support for new cryptographic standards so your options for SMTP are going to be limited.
As this is your DC i assume you have other more modern servers available? It might be easier to use one of them to monitor your DC and send the message? Another option would be to setup an SMTP relay on another internal server that forwards the unencrypted messages from your dc and encrypts them - not ideal but good enough as a temporary hack.