Tuesday, April 30, 2013

WMIC to create a report of free disk space on servers

To see the free space on drives for a server, use the following command.
NOTE:  Replace   with the name of your server.

C:\temp>wmic /AGGREGATE:Off /FAILFAST:On /RECORD:outout.xml /NODE: "" logicaldisk get SystemName,description,DeviceID,FreeSpace
Description              DeviceID  FreeSpace    SystemName
3 1/2 Inch Floppy Drive  A:                     DEN01VMDBSOLO01
Local Fixed Disk         C:        12263886848  DEN01VMDBSOLO01
Local Fixed Disk         D:        78583287808  DEN01VMDBSOLO01
Local Fixed Disk         E:        78348578816  DEN01VMDBSOLO01
CD-ROM Disc              F:                     DEN01VMDBSOLO01
Network Connection       R:        52428800000  DEN01VMDBSOLO01


Even better, you can do so for a whole list of servers, by
A) Creating a comma delimited or newline delimited (on server on each line) list of server names in a .txt file.
Example:
Server1
Server2
Server3
Server4

B) Replacing with @ServerList.txt, where ServerList.txt is the name of your text file.

Awesome.

Creating Hash Values for Strings In MSSQL, DB2 UDB for LUW, and Oracle

It will often occur that we need to search a large character string in a relational database, something like an email address, postal addres...