in reply to Map Drive in Windows (need to authenticate)

Use backtics or system to exec a NET USE.

NET USE [devicename | *] [\\computername\sharename[\volume] [password +| *]] [/USER:[domainname\]username] [/USER:[dotted domain name\]username] [/USER:[username@dotted domain name] [[/DELETE] | [/PERSISTENT:{YES | NO}]] #!/usr/bin/perl my $drive = 'z:'; my $computername = 'zeus'; my $sharename = 'c$'; my $password = 'password'; my $domain = 'some.domain'; my $user = 'god'; my $persistent = 'no'; my $res = `NET USE $drive \\\\$computername\\$sharename $password /USE +R:$domain\\$user /PERSISTENT:$persistent`; error() unless $res =~ m/The command completed successfully/; sub error { print "Error!\n" and exit }

You will get a conflict of credential error if you are logged on as administrator and try to use the same username/password (that's windows for you). In this case just don't pass a password and username and it will work.

cheers

tachyon

s&&rsenoyhcatreve&&&s&n.+t&"$'$`$\"$\&"&ee&&y&srve&&d&&print

Replies are listed 'Best First'.
Re: Re: Map Drive in Windows (need to authenticate)
by dbrock (Sexton) on Mar 04, 2003 at 04:17 UTC
    Thank You... I started experimenting and was on the same track as your example... Darrick...