I am working on a perl script that is used to test the operation of several services. To do this, we use WMI to query remote Windows servers:
my $WMI_locator = Win32::OLE->new('WbemScripting.SWbemLocator'); $WMI_locator->{Security_}->{AuthentificationLevel} = 6; my $computer = $WMI_locator->ConnectServer($server, 'root\cimv2', $adminuser, $adminpasswd); my $services = $computer->ExecQuery('SELECT * FROM Win32_Service', 'WQL', $flag_return_immediately | $flag_forward_only);
This piece of code works great when executed on my dev laptop. However, when I try to start it from a production server, strange things arise: for some computers with remote windows, I can get about half the list of services.
I reviewed this and found that the problem only occurs on servers with a large number of services (about 150) and for which there is a difference in the average ping (~ 60 ms on the local server, ~ 215 ms on the production server). The problem seems to come from WMI, not perl; I tried to request the servers from the DOS command line, and I get an error when trying to get the services, although the processor request works very well:
E:\>wmic /NODE:server /USER:adminuser /PASSWORD:adminpasswd SERVICE GET Caption, State Node - server ERROR: Code = 0x800706be Description = The remote procedure call failed. Facility = Win32 E:\>wmic /NODE:server /USER:adminuser /PASSWORD:adminpasswd CPU GET Name, Status Name Status Intel(R) Xeon(R) CPU X5650 @ 2.67GHz OK Intel(R) Xeon(R) CPU X5650 @ 2.67GHz OK Intel(R) Xeon(R) CPU X5650 @ 2.67GHz OK Intel(R) Xeon(R) CPU X5650 @ 2.67GHz OK
Given this, I assume that the problem is with the network, but we are now delving into a country with which I am not familiar. Is there any parameter that I missed and / or something is wrong with the way I do it?
Thank you for your responses!
sylv1 source share