A disk that shows up in the Disk Management Tool with the annotation "Not initialized" is not of much use. It's not used by Windows as a writable file system; you have to initialize it first before you can use it as storage.
Initialization of the disk involves, in practice, writing the disk signature. Before that, the Signature value is zero. It is this characteristic that can be used to detect an uninitialized disk using a WMI query.
The query (which can be executed within the WBEMTest tool) is of the form:
SELECT DeviceID,Signature FROM Win32_DiskDrive WHERE Signature = 0
After executing such a query, only uninitialized disks will be shown (as a result).
It's easy to check that after performing disk initialization:
The same query already yields an empty collection - there are no disks with a zero signature value:
The above example is from an already installed and running system. However, it is possible to encounter an uninitialized disk during the Task Sequence operation during the operating system installation (OSD) process, when it is the only hard drive in the system. In such a case, if before disk operations (partitioning and formatting) we try to refer to some package (Package) Configuration Manager a we hit a nasty error, resulting from the lack of space to save the package.
Using a WMI query as a condition avoids such a trap and creates a place to save the downloaded package if it did not exist before.
HOW TO USE WMI QUERY TO DETECT THAT THE DISK IS NOT INITIALIZED?
Business Applications:
- Support and development of Microsoft and Nintex based applications
- Application design and development including digital processes
- Invoice management
- Requisition management
- Contract management
- Modern Intranet
ISCG sp. z o.o.
Al. Jerozolimskie 178, 02-486 Warsaw
NIP: 5262798378
KRS: 0000220621
Phone