You should be able to administer remotely by connecting to the IPC$ share on each workstation.
use strict;
use Win32::NetResource;
my %hash = (RemoteName => '\\\\workstation\\IPC$');
my $password = 'xxxxx';
my $username = 'xxxxx';
Win32::NetResource::AddConnection(\%hash, $password, $username, 0) or
die "Unable to connect to resource";
# do administrative stuff here
Win32::NetResource::CancelConnection('\\\\workstation\\IPC$', 1, 1) or
die "Unable to disconnect from resource";
This Perl code is the equivalent of these NT commands:
net use \\workstation\IPC$ /user:username password
net use \\workstation\IPC$ /delete
If you prefer to run your scripts with the -w switch, then you'll have to use this for the hash:
my %hash = (RemoteName => '\\\\workstation\\IPC$',
Type => RESOURCETYPE_ANY,
Scope => RESOURCE_GLOBALNET,
Usage => RESOURCEUSAGE_CONNECTABLE,
DisplayType => RESOURCEDISPLAYTYPE_SHARE
);
Interestingly, if you connect to just \\workstation, you still get a connection to \\workstation\IPC$. Use the NT command NET USE to view your connections.
For your reading pleasure, see pages 42 & 45 of Dave Roth's Win32 Perl Programming: The Standard Extensions.
Gary W. MacDonald
-----Original Message-----
From: Steve Nolan [mailto:[EMAIL PROTECTED]]
Sent: Friday, December 01, 2000 9:57 AM
To: [EMAIL PROTECTED]
Subject: Remote admin with multiple passwords?
Hi, all.
I realize this is a question that deals more with my lack of understanding of NT than with any specifics of perl, but I'm having no luck finding an answer elsewhere so perhaps someone here could take pity and bump my clue level up a notch:
I have a number of NT4 standalone (not domain members) workstations that I want to be able to perform remote administration on from my own workstation. The problem is that there are some 300 workstations in almost 40 different geographic locations, with a different machine Administrator password at each site.
The scripts I've seen thus far all seem to assume that the executor of the script has domain admin privileges (not applicable in this environment) or a shared password with the boxes being administered. So, when I run a script against a machine where this is not the case, I either get a failure, or in some cases a GUI Win32 dialog prompting me for a username/password pair. This rather defeats the purpose of the scripting. ;-)
Given that I can't change the authentication model (it's there to stay, just the way it is) is there any way I can programmatically connect to the remote machines with the administrator password appropriate to each site? (And yes, I fully understand that leaving passwords in plaintext in scripts is a profoundly bad idea. If it looks necessary the script can be encrypted and a key provided at runtime .. Entering one password is not an inconvenience. Entering forty is.) Any suggestions? Pointers? Fine Manuals that I could Read?
Thanks!
-Steve.
Steve Nolan
Vancouver Island Regional Library
Systems Support Services
(250) 758-4697 x 217
_______________________________________________
Perl-Win32-Admin mailing list
[EMAIL PROTECTED]
http://listserv.ActiveState.com/mailman/listinfo/perl-win32-admin
