Logical Disk Monitoring

hi

i need to use below script for specific group of serves

$disks = Get-SCOMClass -Name "Microsoft.Windows.Server.LogicalDisk" | Get-SCOMClassInstance 
foreach ($disk in $disks) 

   $query = GET-WMIOBJECT query SELECT * from win32_logicaldisk where DeviceID = '$disk'" -ComputerName $disk.Path | Select-Object Size, FreeSpace 
   $size = $query.Size 
   $free = $query.FreeSpace 
   $percent = $free / $size 
   $pervalue = "{0:P0}" -f $percent 
   $sizeGB = "{0:N1}" -f ($size / 1024 / 1024 / 1024) 
   $freeGB = "{0:N1}" -f ($free / 1024 / 1024 / 1024)

   $dataobject = $ScriptContext.CreateFromObject($disk, "Id=Id,HealthState=HealthState,DisplayName=DisplayName,Server=Path", $null) 
   $dataobject["% Free"] = $pervalue 
   $dataobject["Size (in GB)"] = $sizeGB 
   $dataobject["Free Space (in GB)"] = $freeGB 
   $ScriptContext.ReturnCollection.Add($dataobject) 
}

what shall i do?

thanks

September 10th, 2015 4:19am

What are you trying to achieve? You seem to be trying to use a widget and from there actually connect to specific computers using WMI?

Why not do everything against SCOM? I have an example here:

http://blogs.technet.com/b/manageabilityguys/archive/2015/08/04/sample-quot-blue-bar-quot-dashboards.aspx

Regards

Graham

Free Windows Admin Tool Kit Click here and download it now
September 10th, 2015 4:34am

This topic is archived. No further replies will be accepted.

Other recent topics Other recent topics