send notification for list of windows server requires reboot

shanmugasundaram rageswari 96 Reputation points
2023-02-26T19:31:44.98+00:00

Hi Folks

I been assigned to write powershell script

  1. get list of win servers requires reboot taken from input file (say serverlist.txt)
  2. send email report to DL or groups

Have anyone done similar kindly share .. thank you

PowerShell
PowerShell
A family of Microsoft task automation and configuration management frameworks consisting of a command-line shell and associated scripting language.
2,039 questions
0 comments No comments
{count} votes

2 answers

Sort by: Most helpful
  1. Rich Matheisen 44,776 Reputation points
    2023-02-26T19:51:24.3466667+00:00

    Use the Get-Content cmdlet to get the list of server names. Loop over that list of names and use Send-MailMessage for each item in the list.

    Now, since it's impossible for a server to receive an e-mail, how will you associate the list of servers that require a reboot with the correct DL?

    Does your SMTP server require the use of SSL? Authenticated or anonymous connections? Will the message be in HTML or plain text? Will each message require customization (e.g., to identify the server in question)?

    I'm sure you'll find quite a few examples of scripts that read a file containing email addresses and that send e-mail to each one.

    Right now, I think your problem lacks sufficient definition. At this point I don't think you know what you don't know!

    0 comments No comments

  2. shanmugasundaram rageswari 96 Reputation points
    2023-02-27T04:18:39.18+00:00

    thank you for reply. the list of servers need reboot come from notepad txt file should go to email , i-e myname@company.com , I am SQL DBA background , i can use dbmail feature do that.. it will be run as SQL agent job.

    I believe there should be a registry key tell if server need reboot , it needs to go from txt each server and generate report and email.

    i DON'T want to reinvent the wheel , if someone already developed something similar i want to use it.