Now, the new IBM Power S1022s (9105-22B) technology-based server extends that leadership and introduces the essential scale-out hybrid cloud platform, uniquely architected to help clients securely and efficiently scale core operational and AI applications anywhere in a hybrid cloud. On a another note, be sure to check us out on our YouTube Channel for more awesome content.IBM® Power® servers are already the most reliable and secure in their class. Hopefully this is exactly what you were looking for. \_Scripts\Get-Uptime.ps1 – Note the two dots before the backslash.Īnd that’s it for getting the Powershell last reboot status. In this example I’ll save it to my C:\_Scripts folder. Copy the script above and save it any location.To dot source the script do the following: Next you need to dot source the script since it is a function. This is a standard with running any Powershell script. First and foremost, you need to set your execution policy to RemoteSigned. In order to the run the script there are a couple of things you need to do. The results are sorted by LastBoot property and the output looks something like this. $Reboots = Get-Uptime -ComputerName $Servers #Get all reboot times and put them in a variable to reference later. Once we got that we’ll run the Get-Uptime script: $Servers = Get-ADComputer -Filter -Properties OperatingSystem | select -ExpandProperty Name | Sort-Object #Get all enabled servers that are in the domain. In my case I am going to run a Powershell command to get all the servers in my domain (that are not disabled) and save it to a variable. We’ll first want to start by getting an array of the computers we want to check against. Uptime = ($Uptime.Days " Days " $Uptime.Hours " Hours " $Uptime.Minutes " Minutes") LastBoot = $OS.ConvertToDateTime($OS.LastBootUpTime) $OS = Get-WmiObject Win32_OperatingSystem -ComputerName $Computer -ErrorAction Stop Get Uptime and Last Reboot Status – Powershell Script I’m sure there are many more use cases to check the last reboot time in Windows Server but they can all be identified with this handy Powershell that I use pretty regularly. I’ve come across this several times during my previous life as a desktop administrator and it seems to always be an issue when they have to “stop what they’re doing and reboot.” While there is some validity to it, there never seems to be a good time because of whatever reason they come up with. They have like 50,000 tabs open along with 30 other windows open and wonder their system is always slow. So being able to run this one liner Powershell command would be able to tell you if it has been more than a month or not.Īside from Windows updates, I’m sure we have all come across that one user who absolutely hates to restart their computer. Normally, at least in the Microsoft world, when you apply Windows Updates it requires a system restart for those installed updates to be applied. One reason that comes to mind is how long it has gone without being patched. There are many reasons for a systems administrator to want to know when the last time a computer or server was rebooted. Powershell Uptime Script – Why is it needed? The whole idea is be to be able to get the last reboot time remotely as well as get-uptime for multiple computers in your org. In this article I’ll share the Get-Uptime script that was initially written by Reddit user /u/OttoVonMonstertruck and added upon by yours truly. But what if you wanted to check the status of multiple computers? What about wanting to check them remotely?. If you’re on a single machine and want to check when the last time a computer rebooted, you would use the systeminfo command and search for the System Boot Time property of that command.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |