Simon YEE/NYP/SINGOV is out of the office.

2009-03-24 Thread Simon YEE
I will be out of the office from  03/23/2009 to 03/26/2009.

Thank you for the email. I shall respond as soon as I get back to the
office.

Regards___
Perl-Win32-Users mailing list
Perl-Win32-Users@listserv.ActiveState.com
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs


RE: WMI remote querying

2009-03-24 Thread Ken Cornetet
Try it like this:

 

use strict;

use Win32::OLE;

 

use constant wbemFlagReturnImmediately => 0x10;

use constant wbemFlagForwardOnly => 0x20;

use constant WbemAuthenticationLevelPktPrivacy => 6;

 

my $computer = "xxx";

my $admin = "yyy";

my $pwd = "zzz";

 

my $wbem = Win32::OLE->new('WbemScripting.SWbemLocator');

my $objWMIService = $wbem->ConnectServer($computer,"",$admin,$pwd); 

$objWMIService->Security_->{authenticationLevel} =
WbemAuthenticationLevelPktPrivacy;

 

my $colItems = $objWMIService->ExecQuery("SELECT * FROM
Win32_OperatingSystem", "WQL", wbemFlagReturnImmediately |
wbemFlagForwardOnly);

 

foreach my $objItem (in $colItems) {

  print "ServicePackMajorVersion:
$objItem->{ServicePackMajorVersion}\n";

  print "ServicePackMinorVersion:
$objItem->{ServicePackMinorVersion}\n";

  print "\n";

}

 

 

 

From: perl-win32-users-boun...@listserv.activestate.com
[mailto:perl-win32-users-boun...@listserv.activestate.com] On Behalf Of
David Evans
Sent: Tuesday, March 24, 2009 8:21 AM
To: perl-win32-users@listserv.ActiveState.com
Subject: WMI remote querying

 

Hi wonderful people

 

I hope one of you can help me.  I need to access WMI on a remote Win XP
desktops and I am getting permission errors when using the local admin
account on the remote box.  Any ideas?

 

CODE:

 

use DBI;
my $machine = 'server';
my $dbh = DBI->connect('dbi:WMI:'.$machine,'admin','admin');
  print "$dbh\n";
my $sth = $dbh->prepare('SELECT * FROM Win32_OperatingSystem');
$sth->execute;
while (my @row = $sth->fetchrow) {
my $printer = $row[0];
printf "ServicePackMajorVersion is %s\n",
$printer->{ServicePackMajorVersion}, $machine;
printf "ServicePackMinorVersion is %s\n",
$printer->{ServicePackMinorVersion}, $machine;
};

ERROR:

 

C:\Scripting\toys>wmi.pl
Win32::OLE(0.1707) error 0x80070005: "Access is denied"
after character 0 in "winmgmts:\\server\root\cimV2" at
C:/Perl/site/lib/DBD/
WMI.pm line 95

Any help greatly appreciated.

 

Thanks

 

Dave

 

PS

My system is...

Host: WinXP SP2

Perl: 5.8.8 Build 822

DBD::WMI 0.06

DBI 1.607

___
Perl-Win32-Users mailing list
Perl-Win32-Users@listserv.ActiveState.com
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs


Re: WMI remote querying

2009-03-24 Thread Mark Leighton
You may want to ensure that you are using fully qualified credentials. 
Sometimes see issues with that, especially when local or remote machines have 
trust relationships.

ie.
my $dbh = DBI->connect('dbi:WMI:'.$machine,$machine.'\admin','admin');

Other than that, haven't used the DBD interfaces before - usually just use the 
OLE methods directly and they haven't given problems.

You may want to confirm passwords, etc. using the wmic utility before worrying 
about the underlying Perl code.

eg.
wmic /NODE:machine /USER:machine\admin OS LIST BRIEF

Mark

---
Mark Leighton
CLIC LAN Supervisor, Information Commons, University of Toronto
E-mail: mark{DOT}leighton{AT}utoronto.ca



 Original Message  
Subject: WMI remote querying
From: David Evans 
To: perl-win32-users@listserv.ActiveState.com
Date: Tuesday, March 24, 2009 8:21:27 AM

> Hi wonderful people
>  
> I hope one of you can help me.  I need to access WMI on a remote Win XP 
> desktops and I am getting permission errors when using the local admin 
> account on the remote box.  Any ideas?
>  
> CODE:
>  
> use DBI;
> my $machine = 'server';
> my $dbh = DBI->connect('dbi:WMI:'.$machine,'admin','admin');
>   print "$dbh\n";
> my $sth = $dbh->prepare('SELECT * FROM Win32_OperatingSystem');
> $sth->execute;
> while (my @row = $sth->fetchrow) {
> my $printer = $row[0];
> printf "ServicePackMajorVersion is %s\n", 
> $printer->{ServicePackMajorVersion}, $machine;
> printf "ServicePackMinorVersion is %s\n", 
> $printer->{ServicePackMinorVersion}, $machine;
> };
> ERROR:
>  
> C:\Scripting\toys>wmi.pl
> Win32::OLE(0.1707) error 0x80070005: "Access is denied"
> after character 0 in "winmgmts:\\server\root\cimV2" at 
> C:/Perl/site/lib/DBD/
> WMI.pm line 95
> Any help greatly appreciated.
>  
> Thanks
>  
> Dave
>  
> PS
> My system is...
> Host: WinXP SP2
> Perl: 5.8.8 Build 822
> DBD::WMI 0.06
> DBI 1.607
> 
> 
> 
> 
> ___
> Perl-Win32-Users mailing list
> Perl-Win32-Users@listserv.ActiveState.com
> To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs
___
Perl-Win32-Users mailing list
Perl-Win32-Users@listserv.ActiveState.com
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs


RE: WMI remote querying

2009-03-24 Thread William . Hoopes
Aside from the userid and possibly the password, your code looks good.
I copied the code and ran it with no issues.

By default, the admin account is named 'administrator' not 'admin'

 

Output was:

 

DBI::db=HASH(0x1b9fd3c)

ServicePackMajorVersion is 3

ServicePackMinorVersion is 0

 

From: perl-win32-users-boun...@listserv.activestate.com
[mailto:perl-win32-users-boun...@listserv.activestate.com] On Behalf Of
David Evans
Sent: Tuesday, March 24, 2009 8:21 AM
To: perl-win32-users@listserv.ActiveState.com
Subject: WMI remote querying

 

Hi wonderful people

 

I hope one of you can help me.  I need to access WMI on a remote Win XP
desktops and I am getting permission errors when using the local admin
account on the remote box.  Any ideas?

 

CODE:

 

use DBI;
my $machine = 'server';
my $dbh = DBI->connect('dbi:WMI:'.$machine,'admin','admin');
  print "$dbh\n";
my $sth = $dbh->prepare('SELECT * FROM Win32_OperatingSystem');
$sth->execute;
while (my @row = $sth->fetchrow) {
my $printer = $row[0];
printf "ServicePackMajorVersion is %s\n",
$printer->{ServicePackMajorVersion}, $machine;
printf "ServicePackMinorVersion is %s\n",
$printer->{ServicePackMinorVersion}, $machine;
};

ERROR:

 

C:\Scripting\toys>wmi.pl
Win32::OLE(0.1707) error 0x80070005: "Access is denied"
after character 0 in "winmgmts:\\server\root\cimV2" at
C:/Perl/site/lib/DBD/
WMI.pm line 95

Any help greatly appreciated.

 

Thanks

 

Dave

 

PS

My system is...

Host: WinXP SP2

Perl: 5.8.8 Build 822

DBD::WMI 0.06

DBI 1.607

___
Perl-Win32-Users mailing list
Perl-Win32-Users@listserv.ActiveState.com
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs


WMI remote querying

2009-03-24 Thread David Evans
Hi wonderful people
 
I hope one of you can help me.  I need to access WMI on a remote Win XP
desktops and I am getting permission errors when using the local admin
account on the remote box.  Any ideas?
 
CODE:
 
use DBI;
my $machine = 'server';
my $dbh = DBI->connect('dbi:WMI:'.$machine,'admin','admin');
  print "$dbh\n";
my $sth = $dbh->prepare('SELECT * FROM Win32_OperatingSystem');
$sth->execute;
while (my @row = $sth->fetchrow) {
my $printer = $row[0];
printf "ServicePackMajorVersion is %s\n",
$printer->{ServicePackMajorVersion}, $machine;
printf "ServicePackMinorVersion is %s\n",
$printer->{ServicePackMinorVersion}, $machine;
};

ERROR:
 
C:\Scripting\toys>wmi.pl
Win32::OLE(0.1707) error 0x80070005: "Access is denied"
after character 0 in "winmgmts:\\server\root\cimV2" at
C:/Perl/site/lib/DBD/
WMI.pm line 95

Any help greatly appreciated.
 
Thanks
 
Dave
 
PS
My system is...
Host: WinXP SP2
Perl: 5.8.8 Build 822
DBD::WMI 0.06
DBI 1.607
___
Perl-Win32-Users mailing list
Perl-Win32-Users@listserv.ActiveState.com
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs