Worklet: Get-DiskSpace



 _____        _           ______  _       _                                   
|  __ \      | |          |  _  \(_)     | |                                  
| |  \/  ___ | |_  ______ | | | | _  ___ | | __ ___  _ __    __ _   ___   ___ 
| | __  / _ \| __||______|| | | || |/ __|| |/ // __|| '_ \  / _` | / __| / _ \
| |_\ \|  __/| |_         | |/ / | |\__ \|   < \__ \| |_) || (_| || (__ |  __/
 \____/ \___| \__|        |___/  |_||___/|_|\_\|___/| .__/  \__,_| \___| \___|
                                                    | |                       
                                                    |_|                       

https://github.com/bragdonjm/PS-Automox-Worklets/blob/main/Worklets/Get-DiskSpace.ps1

End users calling you day and night complaining about disk space? Need a fast way to check remote disk space? Are you
running Automox? You are in luck! Use this script to report back disk space usage and User Folder total usage. 

Note: 
- Powershell is only. 
- Verbose is supported
- We can add additional folders on request. 

Usage:
Example:  .\Get-DiskSpace.ps1

DeviceID DriveType VolumeName FreeSpaceGB Capacity
-------- --------- ---------- ----------- --------
C:               3            45.62       237.87  
E:               3 DATA       344.43      953.85  



FolderName         Size(Bytes)   Size(MB) Size(GB)
----------         -----------   -------- --------
C:\Users\bragdonjm 72281745986 68933.2447  67.3176
C:\Users\Public       99261035    94.6627   0.0924

Example: .\Get-DiskSpace.ps1 -Verbose -extraDirectory 'C:\Program Files'

VERBOSE: Get-DiskSpace.ps1 Initial Setup, Started running on 10/03/2020 09:36:43
VERBOSE: Pulling disk information...
VERBOSE: Getting information about all user directories...
VERBOSE: Getting information from C:\Program Files
VERBOSE: Pulling information from all specified directories. This can take some time...
VERBOSE: Processing C:\Users\bragdonjm
VERBOSE: Processing C:\Users\Public
VERBOSE: Processing C:\Program Files

DeviceID DriveType VolumeName FreeSpaceGB Capacity
-------- --------- ---------- ----------- --------
C:               3            45.59       237.87  
E:               3 DATA       344.43      953.85  



FolderName         Size(Bytes)   Size(MB) Size(GB)
----------         -----------   -------- --------
C:\Users\bragdonjm 72315889201 68965.8062  67.3494
C:\Users\Public       99261035    94.6627   0.0924
C:\Program Files   22967070001 21903.1048  21.3898


VERBOSE: Executed in: 13 seconds



Faq:
Q: Why did you leave didnt you add directory XYZ? 
A: Looking for feedback from the public. Keep in mind more folders means more calculation time.

Q: Why no JSON this time? 
A: I dont forsee this being useful to hand data elsewhere. A human will probably read this.

Q: Why not layer on some folder cleaning?
A: We could do that, but I am always trigger shy on weaponizing any script. It would have to be well thought out and very targeted.  
   Maybe we could do something like DeleteThisDirectory or something that could be weaponized. 


1 Like