$freespace = Get-WmiObject -Class Win32_logicalDisk | ? {$_.DriveType -eq '3'}$drive = ($FreeSpace.DeviceID).Split("=")"Your $drive Free Space Percentage is {0:P2}" -f ($freespace.FreeSpace / $freespace.Size) The above code will do the trick.Explanation:{...
function DriveSpace { param( [string] $strComputer) "$strComputer --- Free Space (percentage) ---" # Does the server responds to a ping (otherwise the CIM queries will fail) $result = Test-connection "$strComputer" -quiet if ($result) { # Get the Disks for this computer $colDisks...
$logicaldisks = Get-WmiObject -ComputerName $s Win32_Logicaldisk Foreach ($l in $logicaldisks) { $totalsize = $l.size $freespace = $l.freespace if ($freespace -gt 0) { $percentagefree = ($freespace / $totalsize ) * 100 Write-Host $l.deviceid " ...
.DESCRIPTION This function returns the general usage information regarding the specified disk, in terms of free space, total space, and available space in percentage. .PARAMETER DeviceID The device ID to be used as a filter, defaults to the home drive. .EXAMPLE PS> Get_Disk_Storage_Info ...
The script displays a list of logical drives, their size, and free space percentage. To use this script in PowerShell Core, just replaceGet-WmiObjectwithGet-CimInstance. If you don’t want to simply display the information about the free space on a disk, but take some action instead (send...
The Grid view output can be sorted on any selected columns shows the amount of disk space in use, the name of the server, the volume name, the total size of the disk, the available free space, the partition identifier and the percentage of free space. You can do a search by placing ...
$cpuUsage=Get-Counter-Counter"Processor(_Total)% Processor Time" $cpuUsage.CounterSamples |ForEach-Object{ Write-Host"Processor:$($_.InstanceName), Usage:$($_.CookedValue)%" } Explanation:This script retrieves CPU usage information for all processors and displays the usage percentage for each....
(_Total)\% Free Space" sampleRate="PT15S" unit="Percent"> <annotation displayName="Disk free space (percentage)" locale="en-us"/> </PerformanceCounterConfiguration> <PerformanceCounterConfiguration counterSpecifier="\LogicalDisk(_Total)\Free Megabytes" sampleRate="PT15S" unit="Count"> <annotation...
[decimal]$warningThresholdSpace = 20 # Percentage of free disk space - Warning (orange). [decimal]$criticalThresholdSpace = 10 # Percentage of free disk space - critical (red) ### # Monitoring Process ### [System.Array]$results = foreach ($cmp in $computers) {...
[-SuccessPercentage <Int32>] [-SuppressRestartServer <Boolean>] [-SuppressRestartWorkstation <Boolean>] [-UseBranchCache <Boolean>] [-UserNotification <UserNotificationOption>] [-UseUtc <Boolean>] [-VerboseLevel <VerboseLevelType>] [-WriteFilterHandling <Boolean>] [-DisableWildcardHandling] [-...