CGI/Perl Guide | Learning Center | Forums | Advertise | Login
Site Search: in

  Main Index MAIN
Search Posts SEARCH
Who's Online WHO'S
Log in LOG

Home: Perl Programming Help: Intermediate:
Using Win32::OLE from cgi-bin



Jan 8, 2009, 9:29 AM

Post #1 of 2 (649 views)
Using Win32::OLE from cgi-bin Can't Post

In Perl you can use the module Win32::OLE manipulate windows objects on your own computer. I was wondering if you can do it remotely using cgi-bin. For example, the code below works perfectly on the command prompt, but from cgi-bin we get an error message instead.

Can't call method "InstancesOf" on an undefined value at (file name) line 5.

The idea was that maybe using CGI we could hack into our own servers. (We were thinking of writing an external DNS management client.)

use Win32::OLE 'in'; 
my $strComputer = [IP address];
my $objWMI = Win32::OLE->GetObject("winmgmts:\\\\$strComputer\\root\\cimv2");
my $objDisks = $objWMI->InstancesOf("Win32_LogicalDisk");
for my $objDisk (in $objDisks) {
print "DeviceID: ", $objDisk->DeviceID,"\n";
print "FileSystem: ", $objDisk->FileSystem ,"\n";
print "FreeSpace: ", $objDisk->FreeSpace,"\n";
print "Name: ", $objDisk->Name,"\n";
print "Size: ", $objDisk->Size,"\n";
print "\n";


Jan 8, 2009, 1:28 PM

Post #2 of 2 (644 views)
Re: [mrcactu5] Using Win32::OLE from cgi-bin [In reply to] Can't Post

I don't know if you can or can't. My guess is you can't. And judging by the fact your program does not create the $objWMI object it appears as though you can't.


Search for (options) Powered by Gossamer Forum v.1.2.0

Web Applications & Managed Hosting Powered by Gossamer Threads
Visit our Mailing List Archives