Forum Discussion
Hey Stuart
After spending some time on it i managed to get some sample scripts and understood exactly what it does and how.
## Active Script ##
$hostname = '##SYSTEM.HOSTNAME##'
$namespace = "root\cimv2"
$query = "SELECT NAME FROM Win32_LogicalDisk"
$output = Get-WmiObject -Namespace $namespace -ComputerName $hostname -Query $query
foreach ($instance in $output) {
$name = $instance.Name
Write-Host "$name##$name"
}
exit
## Collector Script ##
$hostname = '##SYSTEM.HOSTNAME##'
$wildvalue = '##WILDVALUE##'
$namespace = "root\cimv2"
$query = "SELECT * FROM Win32_LogicalDisk WHERE NAME='$wildvalue'"
$output = Get-WmiObject -Namespace $namespace -ComputerName $hostname -Query $query
Write-Host "Size=$($output.Size)"
Write-Host "FreeSpace=$($output.FreeSpace)"
exit
Now i remain with few other questions
1. This is WMI so gets me the partition names, how can i get the paths to iterate in Active script
So I manually Added monitored instances under my resource, but didn't work for me.
2. Tried Setting up UNC.PATH, didn't work
I'll spend time trying few things here n there until I hear back from you.
Please advice
Thank you
Related Content
- 3 months ago
- 7 months ago
- 8 months ago