SQL Powershell Script To Check the Memory Utilization

  • Comments posted to this topic are about the item SQL Powershell Script To Check the Memory Utilization

  • hi, getting error

    Get-WmiObject : Cannot bind argument to parameter 'Class' because it is null.

    At C:\Query\Check the Memory Utilization.ps1:4 char:21

    + $Size=(get-wmiobject <<<< -ComputerName $args[0] Win32_PhysicalMem

    ory| Measure-Object -Property Capacity -Sum).Sum/1gb

    + CategoryInfo : InvalidData: (:) [Get-WmiObject], ParameterBindi

    ngValidationException

    + FullyQualifiedErrorId : ParameterArgumentValidationErrorNullNotAllowed,M

    icrosoft.PowerShell.Commands.GetWmiObjectCommand

    Total RAM : GB

    The term 'get-counter' is not recognized as the name of a cmdlet, function, scr

    ipt file, or operable program. Check the spelling of the name, or if a path was

    included, verify that the path is correct and try again.

    At C:\Query\Check the Memory Utilization.ps1:9 char:12

    + get-counter <<<< -COMP $args[0] -Counter "\Memory\Available MBytes" -Sample

    Interval 1 -MaxSamples 30 | select -ExpandProperty countersamples | Select-Ob

    ject timestamp, @{Name="AvailableMemory(MB)";Expression={"{0,9:#,#.000}" -f [ma

    th]::round($_.CookedValue, 3) }},@{Name="UsedMemory(MB)";Expression={"{0,9:#,#.

    000}" -f [math]::round($value- $_.CookedValue, 3) }}, @{Name="MemoryUtilization

    (%)";Expression={"{0,9:#,#.000}" -f [math]::round(($value-$_.CookedValue)*100/$

    value, 3) }}

    + CategoryInfo : ObjectNotFound: (get-counter:String) [], Command

    NotFoundException

    + FullyQualifiedErrorId : CommandNotFoundException

  • I also get the same error.

    Lee

  • You have to specify your HOSTNAME, or you will get that error.

    However - even when I do specify mine, I still get the 'The term 'get-counter' is not recognized as the name of a cmdlet, function, script file, or operable program', but it does give me a total RAM reading.

  • Another good script Raushan.

Viewing 5 posts - 1 through 4 (of 4 total)

You must be logged in to reply to this topic. Login to reply