DISK USAGE V1.5 Sainath Kev MICROSOFT MVP – ENTERPRISE MOBILITY DATED: 26/10/2015 Contents Abstract ......................................................................................................................................................... 3 Logical Components: ..................................................................................................................................... 3 Topologies: .................................................................................................................................................... 3 Build Section: ................................................................................................................................................ 5 Installation Requirements:........................................................................................................................ 5 Installation Steps:...................................................................................................................................... 5 Tool in Action ............................................................................................................................................ 5 Abstract This article presents DU (Disk Usage), a command line tool which reports disk space usage on Windows Operating System. Often System Administrators have the task to report the disk usage of their infrastructure servers, clients and POS machines and imply various methods to poll information such as WMI, PowerShell, System Centre tools etc. DU reads the files and folder items and their relative disk size information. Carefully used, this tool can export the information in CSV format and be automated to poll information periodically on Wintel infrastructure. The main features of DU is that it does not require any application code changes and can be executed on any Windows OS edition (assuming Windows XP and above kernel code base). Logical Components: The following table lists the components available in a DU tool. Component Description Required DU Disk Usage tool used to report disk usage on Yes Windows Operating Systems Topologies: The tool can be installed and executed in following scenarios. a) Standalone Implementation: This configuration is lean and does not contain dependencies. The tool will be installed on the target Windows client and tool reports the disk usage. Some of the prerequisites for this implementation would be to consider 1) The Antivirus tool installed on the client and an exclusion should be defined before executing the executable. 2) The Account to be used for executing the tool should have Local administrator privileges. Benefits Limitations Easy to set up for stand alone or fewer clients Cannot be used as an Enterprise solution for executing on more than 10 systems. No central reporting Table 1: Stand-Alone implementation benefits and limitations b) Automated Implementation: This configuration assume the target infrastructure consists of System Center Configuration Manager (SCCM) to automate the process. The process involves below high level steps SCCM Collection •Create a new collection •customize the query •Add required workstations / Windows clients •Create an advertisement targetting the collection SCCM Advertisement Create MSI package •Create a MSI package with the tool •Add command line parameters •Deploy the package to target collection Deploy Package •Use SSRS for reporting purpose Report Note 1: This implementation would recommend to test the automation process before implementing in the production environment. Note 2: Add Antivirus exclusion for MSI package and executables. Build Section: Installation Requirements: Below are the requirements for installing the tool. Component Disk Usage Download path Permission Antivirus Exclusion Winzip or Winrar Value V1.5 https://technet.microsoft.com/enau/sysinternals/bb896651.aspx Local Administrator Create an AV policy to exclude executable or MSI (for SCCM deployments) Latest version Note 3: Please contact SCCM Administrator for package requirements. Installation Steps: Below are the steps to install the tool Action Logon to the workstation with local administrator privileges Extract the tool Launch the command line and run the tool Artefact Tool in Action Below section shows the tool in action. There are several examples for the available command line switches that user can execute in their target environment. DU.exe Command Line Options: Below are the command line switches available for DU.exe tool Command -C -L Description Print output as CSV. Use –ct for tab delimiting Specify subdirectory depth of information <default is one level> Do not recurse Quiet <no banner> Count each instance of a hardlinked file Show size <in KB> of all subdirectories -n -q -u -v 1. DU.exe –C command Command DU.exe –v –c “c:\Program files\common files” > c:\<yourtarget folder>\output.csv Screenshot 2. DU.exe –l command One of the best command switch when used wisely provides right level of detail folder information. Command Screenshot DU.exe –l 2 “c:\Program Files” Du.exe –l 3 “c:\Program Files” Will display information till 3rd level of the path provided The above command can be used in conjunction with –ct and store it in a central share for reporting purpose. 3. DU.exe –n command This command cannot be executed with other combinational switches. When tried, the result would return DU.exe syntax as shown below Command DU.exe –n“c:\Program Files” Screenshot 4. DU.exe –q command Command DU.exe –q“c:\Program Files” Screenshot 5. DU.exe –v command This command is best used with other command line switches as seen in above examples.