If I then submit a "straight" query...# Connect to WMI on reporting server # my $SWbemLocator = Win32::OLE->new("WbemScripting.SWbemLocator") or FatalCOMError("Can't open WbemScripting object"); my $SWbemServices = $SWbemLocator->ConnectServer($Server, "root/sms/si +te_$SiteCode") or FatalCOMError("Can't connect to server: $Server");
...$count contains the count of items in the collection. Unfortunately, on a large collection, this can be a bit slow. Ideally, I'd use the count(*) WQL command like so;# Get count of clients in collection my $WQL = q/select * from SMS_CM_RES_COLL_CEN01562/; $Colln = $SWbemServices->ExecQuery($WQL,"WQL",16) or FatalErr("Exe +cQuery for Clients failed",1); $count = $Colln->{Count};
The problem that I have with this code is that, no matter what I try, I can't get to the actual result!# Get count of clients in collection my $WQL = q/select count(*) from SMS_CM_RES_COLL_CEN01562/; $Colln = $SWbemServices->ExecQuery($WQL,"WQL",16) or FatalErr("Exe +cQuery for Clients failed",1);
If I try the same query on WbemTest, I get a single-line answer that shows the correct answer. How do I get to it in Perl?
Can anyone help?
In reply to Extracting WQL "count" results by rod
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |