![]() ![]() The transformation can be achieved with an easy one-liner (for an explication of which you can refer to the final part my other blog post: ::ParseExact($(systeminfo |įind "System Boot Time:").substring(27,20),"dd/MM/yyyy, HH:mm:ss",$null) In this case, better than a System.String, we would like to have a System.DateTime variable. ![]() systeminfo |Īs usual in Powershell, our aim is to return a re-usable object. The returned information is of System.String type. Used in conjunction with another legacy command, FIND, it allows you to see system boot time. Systeminfo.exe is the old good tool every Windows admin used to get a quick look at system information. Let's start from the beginning: there are three possible legacy executables that you can use the retrieve the last reboot date: As a consequence those that are based on text parsing or regular expressions might need some correction if you want to run them on a computer with different regional settings. In any case, please notice that the following examples have been prepared and tested on computers with European settings for the date (dd/MM/yyyy). Going through them all will give you an interesting insight of how you can take advantage of Windows Powershell as your all-in-one administration tool. Some syntaxes are easier and some are trickier. In the Win32_OperatingSystem WMI instanceĮach of this approach has pros and cons. In more recent Windows versions some alternatives to those legacy Tools have appeared and we can today use the information stored: In old times (more or less one to two decades ago) we could (and still we can) use various legacy tools to fetch a Windows computer boot timestamp. ![]()
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |