something exciting

Some information about the exciting thing

Table of contents generated with markdown-toc


function Get-Resources {
        $ComputerName = $env:ComputerName
    # Processor utilization
    # Get-WmiObject -ComputerName $computer -Class win32_processor -ErrorAction Stop | Measure-Object -Property LoadPercentage -Average | Select-Object *
    $cpu = Get-WmiObject win32_perfformatteddata_perfos_processor -ComputerName $ComputerName | Where-Object { $ -eq "_total" } | Select-Object -ExpandProperty PercentProcessorTime -ErrorAction silentlycontinue
    # Memory utilization
    $ComputerMemory = Get-WmiObject -ComputerName $ComputerName -Class win32_operatingsystem -ErrorAction Stop
    $Memory = ((($ComputerMemory.TotalVisibleMemorySize - $ComputerMemory.FreePhysicalMemory) * 100) / $ComputerMemory.TotalVisibleMemorySize)
    $RoundMemory = [math]::Round($Memory, 2)
    # Free disk space
    $disks = get-wmiobject -class "Win32_LogicalDisk" -namespace "root\CIMV2" -ComputerName $ComputerName
    $results = foreach ($disk in $disks) {
        if ($disk.Size -gt 0) {
            $size = [math]::round($disk.Size / 1GB, 0)
            $free = [math]::round($disk.FreeSpace / 1GB, 0)
                Drive             = $disk.Name
                Name              = $disk.VolumeName
                "Total Disk Size" = $size
                "Free Disk Size"  = "{0:N0} ({1:P0})" -f $free, ($free / $size)

    # Write results
    Write-host "Resources on" $ComputerName "- RAM Usage:"$RoundMemory"%, CPU:"$cpu"%, Free" $free "GB"

Back to Top


Please feel free to copy parts of the script or if you would like to download the entire script, simple click the download button. You can download the complete repository in a zip file by clicking the Download link in the menu bar on the left hand side of the page.

Report Issues

You can report an issue or contribute to this site on GitHub. Simply click the button below and add any relevant notes. I will attempt to respond to all issues as soon as possible.


Back to Top