use Win32::OLE qw(in); my $ole = Win32::OLE->new('WbemScripting.SWbemLocator') or die "Can't start OLE"; # now in a loop for each ip,hostname,uid,pw set: my $wmi = $ole->ConnectServer($ip, 'root/cimv2', $hostname.'\\'.$uid, $pw, undef, undef, 128);