Hello all,
I am working on a script to access WMI info (cpu, ram, etc.) and display in a web page. I've got things working great for domain machines. My code looks like this:
my $wmi = Win32::OLE->GetObject("winmgmts:\\\\$machineName\\root\\cimv2");
my $sys_set = $wmi->InstancesOf("Win32_ComputerSystem");
foreach my $sys (in($sys_set)) {
$device = $sys->{'Caption'};
$ownerName = $sys->{'PrimaryOwnerName'};
$sysemType = $sys->{'SystemType'};
$domain = $sys->{'Domain'};
}
That's all fine and dandy for a machine on a domain but how do I connect and access the same info from a machine that's only in a workgroup? I have admin passwords for each machine. I've done a lot of searching on the net and I think I'm gonna have to use some form of 'CreateObject("WbemScripting.SWbemLocator")' but I don't know the syntax. I'd like to have one script that will query the network and grab the info regardless of workgroup or domain. Maybe it could try to connect with one method first and if it fails, try to connect with the other method.
Or is there one single connection method I should use that will work regardless of the domain/workgroup setup?
Thanks!!
Tim
_______________________________________________ Perl-Win32-Users mailing list [email protected] To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs
