Hi, I have a bunch of servers that i’d like to run a small script weekly to check they are all being rebooted for windows patches regularly I would also like to list the OS versions too as with older servers on windows 2008 they do not require a reboot and I can quickly identify them and ignore. Essentially i’d like 3 columns
Server name
Last Reboot Date
OS Version
I have tried to work this out myself, found lots of examples of how to get this info such as Get-ComputerInfo but not get anywhere near to creating anything. I got to one point where I had an output to a gridview with the server names & last reboot details but the OS version column kept coming back empty.
And - just to mention it at least once - the support for Windows Server 2008 has ended. If you’re still running servers with this version of Windows Server you should urgently update them to a supported version.
I have tried ‘WindowsProductName’, ‘OperatingSystemVersion’, ‘OSName’ and they all come up blank but I know those fields have contents from running Get-ComputerInfo
However, can you please help me to set this up so I can run it against, I would like to refer to the text files in this these locations and output to email rather than gridview
Sorry, I did not get that. I’d recommend to safe the output of the command to a variable in the first place. So you’re able to use it later on again and again if needed.
If you want to send the output to a file you use Out-File or Set-Content. If you want to send a mail message you use Send-MailMessage and insert it as body or attach the file as attachment.