Device performance details of Windows devices
  • 02 Feb 2024
  • 1 読む分
  • PDF

Device performance details of Windows devices

  • PDF

The content is currently unavailable in Ja - 日本語. You are viewing the default English version.
記事の要約

The following PowerShell script helps the IT Admins to get the details of various performance parameters like CPU usage, memory usage, disk usage, total physical memory, available physical memory, virtual memory available, and virtual memory in use from their managed devices.

  1.  Create a file on your desktop, for example, performance_details.ps1 and open it in a text editor like notepad++

  2. Copy the contents below to the file or click here to download the file.

    # Get CPU Usage
    $cpuUsage = Get-WmiObject -Class Win32_Processor | Measure-Object -Property LoadPercentage -Average | Select-Object -ExpandProperty Average
    
    # Get Memory Usage
    $memory = Get-WmiObject -Class Win32_OperatingSystem
    $totalPhysicalMemory = $memory.TotalVisibleMemorySize
    $freePhysicalMemory = $memory.FreePhysicalMemory
    $availableVirtualMemory = $memory.FreeVirtualMemory
    $virtualMemoryInUse = $memory.TotalVirtualMemorySize - $availableVirtualMemory
    
    # Get Disk Usage
    $diskUsage = Get-WmiObject Win32_LogicalDisk | Where-Object { $_.DriveType -eq 3 } | Select-Object DeviceID, FreeSpace, Size
    
    # Display Results
    Write-Host "CPU Usage: $cpuUsage%"
    Write-Host "Total Physical Memory: $([math]::Round($totalPhysicalMemory / 1MB, 2)) MB"
    Write-Host "Free Physical Memory: $([math]::Round($freePhysicalMemory / 1MB, 2)) MB"
    Write-Host "Available Virtual Memory: $([math]::Round($availableVirtualMemory / 1MB, 2)) MB"
    Write-Host "Virtual Memory In Use: $([math]::Round($virtualMemoryInUse / 1MB, 2)) MB"
    
    Write-Host "`nDisk Usage:"
    $diskUsage | ForEach-Object {
        $drive = $_.DeviceID
        $freeSpace = [math]::Round($_.FreeSpace / 1GB, 2)
        $totalSize = [math]::Round($_.Size / 1GB, 2)
        Write-Host "Drive $drive - Free Space: $freeSpace GB, Total Size: $totalSiz
    
  3. Follow our guide to upload & publish the PowerShell script using Scalefusion Dashboard.

  4. Once the script is executed successfully you will be able to see the data in the Output tab in the View Status report on the Scalefusion dashboard.

Please note that to use the PowerShell scripts, the Scalefusion MDM Agent Application must be installed on the device(s). Please follow our guide to publish and install the Scalefusion MDM Agent Application.

Notes:

  1. The scripts and their contents are sourced from various albeit authenticated Microsoft sources and forums.

  2. Please validate the scripts on a test machine before deploying them on all your managed devices.

  3. Scalefusion has tested these scripts, however, Scalefusion will not be responsible for any loss of data or system malfunction that may arise due to the incorrect usage of these scripts.


この記事は役に立ちましたか?