Windows 10

The most useful PowerShell cmdlet I didn’t know existed

Sometimes I should probably pay more attention.  I use PowerShell a lot.  I use Windows 10 a lot.  But I still missed this one:

image
image
image

Some highlights:

  • Want to know if the device is joined to AD?  Check CsPartOfDomain.  Want to know what domain?  Look at CsDomain (which will be WORKGROUP on an AAD-joined device).
  • Need to know if the device is UEFI or not?  Check to see if the BiosFirmwareType is Uefi.
  • Want to know how long Windows has been running since the last reboot?  Check OsUptime or OsLastBootUpTime.
  • How about the Windows SKU?  OsOperatingSystemSKU will tell you that.
  • Need to get a list of languages that are installed?  OsMuiLanguages has that list.

Overall, it’s kind of like MSINFO32 but in PowerShell, and then some.  Sure, you can find all of this stuff elsewhere (multiple cmdlets, WMI, registry locations, etc.) but remembering one cmdlet is much easier.

Categories: Windows 10

9 replies »

  1. Nice! Needed this “one stop shop” for some image logging I was scripting, perfect timing!

    This is like when someone told me the computer name was in the default Windows File Explorer window in Windows 7 – my reaction was “when did they put that in there?!” and if course it was always there under my nose. By the way this was something I missed in 8, 8.1 and all the 10 builds.

    Like

  2. Ugh… I too use powershell everyday and also missed this little gem!

    Thanks for pointing it out!

    Like

  3. In general I feel like PowerShell is a multi-acre field of ester eggs like this one that is both rewarding and frustrating all at the same time. Thanks Mike.

    Like

  4. Any idea why most of my data (Win10 Ent) would come back blank? Ran Powershell as administrator but it didn’t make any difference. I ran it on a Win Server (Win Sever 2016) in my VMWare system and the majority of the data populated.

    Like