Script for Windows storage audit

I’ve created PowerShell script to collect all important information about windows physical disks, partitions and volumes (logical disks) and its connections. To use it you should have administrator right on target computer, otherwise only simple information about logical disks will be collected. This limitation is due to MSFT_PartitionToVolume WMI class, which is accessible only by local administrators.
Audit script

Windows storage hierarchy explained

Quick cheat sheet:
1) Physical disk, represented by Win32_DiskDrive and MSFT_Disk WMI classes. This is hardware presented to your computer. It is HDD, SSD, FC LUN or iSCSI LUN.
2) Partition, represented by Win32_DiskPartition and MSFT_Partition WMI classes. Partitions are walls that transforming your physical space into rooms, which later can be used to store your data. Physical disk can have 0 or more partitions.
3) Volume, represented by Win32_Volume and MSFT_Volume WMI classes. Volumes are named spaces, from abstract rooms you get living room, kitchen and bedrooms. You format room to make it “named room”. Or in other words, you format partition to some file system, i.e. NTFS, FAT or ReFS. Volumes can store data and provide access to it. One partition can have 0 or 1 volume. When partition has 0 volume, in most cases this means that there is no data accessible by user.
4) Logical Disks, represented by Win32_LogicalDisk. Logical disks are like doors to your named rooms. Without doors you can access your named rooms through windows (mount points) and ventilation (“start \\?\Volume{GUID}\” command), and of course it is not always convenient. So giving your volumes disk letter makes it Logical Disks. One volume equal to 0 or 1 logical disks.

“The update is not applicable to your computer”

Recently I’ve needed to apply 2 patches to our Windows 2008 R2. But both patches show me error “The update is not applicable to your computer”. But I knew for sure, that these updates were applicable, because installed file’s version was lower than the one contained in hotfixes.
In Setup log I’ve got “Windows update could not be installed because of error 2149842967” error.

The problem was that someone disabled Windows Modules Installer service on this machine, which is TrustedInstaller.exe process. After enabling and running this service, I’ve installed both patches successfully.

Wmic exception occured

Some time ago we have faced problem that our script which calls wmic to get some values stopped to work. After a short research we have found that on some servers wmic utility stopped to work, showing exception every time we run any command:

wmic os get caption
Description = Exception occurred.

In the same time wbemtest and powershell worked correctly. The solution was to add “/value” switch to a command:

wmic os get caption /value
Caption=Microsoft Windows Server 2008 R2 Enterprise

For some reason wmic can’t format output as a table (the same error you can get with /format: table switch and get rid of it with /format:list), which is default, or can be done with /all switch. Hope this helps someone.

Error 1602 or 1618 during install of any msi packet

Recently we’ve got error installing driver on our Windows 2008 R2 server. It does not provide any specific error dialog, just constantly showing “Please wait while the application is preparing for the first use”. After you press Cancel, it gives you error message saying that installation could not be completed because other installation is in progress. The only diagnostic message in the Application log was EventID 1033 form MsiInstaller with message “Installation success or error status: 1602” or “Installation success or error status: 1618”. Which obviously not helpful. Internet search revealed, that this message is quite common and can be caused by many things.
Continue reading “Error 1602 or 1618 during install of any msi packet”