Validating operating system properties
Details about the installed operating system on a computer can have a tremendous impact on the operation of a script. In the following sections, we will examine the Win32_OperatingSystem
class and build a function that provides us with the data we need to support our scripts. The class has over 60 properties, but a handful of them are all we will need. We will use the Common Information
Model (CIM) cmdlets to retrieve the data, though using the Windows Management Instrumentation (WMI) cmdlets will work as well. To start off, let's retrieve the (only) instance of the class using the following script:
$os=get-CIMInstance –class Win32_OperatingSystem
Note
There is a lot of confusion between WMI and CIM. The CIM cmdlets introduced in PowerShell Version 3.0 seem to provide the same functionality as the WMI cmdlets that have always been present. The main difference is that the CIM cmdlets use Web Services Management (WSMAN) by default instead...