Jason
I connect all the time. This is what works for me.
(I need to put out pause files and do registry modifications)
I'm probably escaping \ more than I need
but it works. The user selects 1-n hosts from a drop
down that's why the host name is a variable
Hope this helps!!
Martha
# Connect to the hosts
#
$connection = "\\\\$this_host\\d\$";
$passwd = "blahblah";
$usrname = "domain\\username";
$netresource{LocalName}="U:"; #not necessary step, I use this elsewher
in my code
$netresource{RemoteName}= $connection;
$result =
Win32::NetResource::AddConnection(\%netresource,$passwd,$usrname,0);
if ($result == 0) {
Win32::NetResource::GetError($result);
print " path: $netresource{RemoteName}<BR>\n";
print Win32::FormatMessage($result);
print "<BR>Error connecting to share: $netresource{RemoteName}. Error
code: $result <BR>\n";
}
else{
print "<HR>Host Name: <B>$this_host </B><BR>\n";
}
}
-----Original Message-----
From: Jason Howard [mailto:[EMAIL PROTECTED]]
Sent: Monday, March 26, 2001 2:13 PM
To: [EMAIL PROTECTED]
Subject: Win32::Lanman from WEB
I have a perl script that I want to run from a web server. It runs just fine
from a command prompt, but I need to be able to call it from a web page.
For example, I need to click on a link and it map a drive and stop an NT
service. If the perl script is called from a web browser running on the
machine that the web server is on, everything works fine. But if it is
called from a different machine it does not work... Any ideas?
***********************
Here is a sample of what I am doing.
require "cgi-lib.pl";
print "HTTP/1.0 200 OK\n" if $ENV{"PERLXS"}=~/PerlIS/i;
print "Content type: text/html\n\n";
print "<body>";
print "<p><img border='0' src='../sailogo.gif' width='600'
height='83'></p>";
print "<p align='left'><font face='Book Antiqua' size='6'>Test Site for TSM
Service restarting</font></p>";
print "<p> </p>";
use Win32::NetResource;
$User = "administrator";
$Password = "blahblah";
%NetResource = (
LocalName => "X:",
RemoteName => "\\\\1.2.3.4\\c\$"
);
Win32::NetResource::AddConnection ( \%NetResource, $Password,$User);
print "Done";
*********************************
The code runs fine, it just doesn't map the drive.
_______________________________________________________
Send a cool gift with your E-Card
http://www.bluemountain.com/giftcenter/
_______________________________________________
Perl-Win32-Web mailing list
[EMAIL PROTECTED]
http://listserv.ActiveState.com/mailman/listinfo/perl-win32-web
_______________________________________________
Perl-Win32-Web mailing list
[EMAIL PROTECTED]
http://listserv.ActiveState.com/mailman/listinfo/perl-win32-web