Beefy Boxes and Bandwidth Generously Provided by pair Networks
Don't ask to ask, just ask
 
PerlMonks  

Re^2: How to access Storage hidden share

by smw11 (Initiate)
on Jan 28, 2014 at 06:18 UTC ( [id://1072321]=note: print w/replies, xml ) Need Help??


in reply to Re: How to access Storage hidden share
in thread How to access Storage hidden share

Hi, Thanks for the information. I have to update perl script for "I" drive mapping. &resetDriveMapping( "I:", $diskArchive ) ; I have to change perl script I map from "\\store\project" to \\store\projectnew$. The new share is hidden format($). I used following function to test the mapping. thank you. smw11
sub resetDriveMapping { my $isDriveLetter = shift ; my $isSharename = shift ; my $Ifiletest = "$isDriveLetter\\idriveTESTfrom" . $ENV{COMPUTERNA +ME} . ".txt" ; my $Itestmsg = "...resetting: \'$isDriveLetter\' drive mapping fro +m \'$ENV{COMPUTERNAME}\' to \'$isSharename\'" ; &writeLogFile($Itestmsg); my $runCommand = "echo Y|net use $isDriveLetter /DELETE" ; my $retvalue = system($runCommand); if ($retvalue) { &writeLogFile("cannot delete drive $isDriveLetter"); } $runCommand = "net use $isDriveLetter $isSharename" ; $retvalue = system($runCommand); if ($retvalue) { &writeLogFile("cannot map drive $isDriveLetter to $isSharename +"); } #test share mapping $Itestmsg = "...start testing: \'$isDriveLetter\' drive mapping fr +om \'$ENV{COMPUTERNAME}\' to \'$isSharename\'" ; &writeLogFile($Itestmsg); open(ITEST, ">$Ifiletest" ) || &writeLogFile("cannot CREATE $Ifile +test") ; print ITEST "$Itestmsg\n" ; close(ITEST) ; if ( ! -e "$Ifiletest" ) { &writeLogFile("EXITing: test file does not exist \'$Ifiletest\ +'"); exit(0) ; } open(ITEST, "$Ifiletest" ) || &writeLogFile("cannot OPEN $Ifiletes +t") ; my $Itestbuf = "" ; while (<ITEST>) { $Itestbuf = $_ ; } close(ITEST) ; unless ( $Itestbuf ) { &writeLogFile("EXITing: could *not* read test content \'$Ifile +test\'"); exit(0) ; } else { unlink( $Ifiletest ) || &writeLogFile("could not DELETE $Ifile +test") ; &writeLogFile("...end testing: \'$isDriveLetter\' drive mappin +g COMPLETED successfully") ; } }

Replies are listed 'Best First'.
Re^3: How to access Storage hidden share
by NetWallah (Canon) on Jan 28, 2014 at 06:40 UTC
    I was unable to detect a question or request in your post, so it is difficult to guess what you expect in response.

    You seem to have ignored the advice on avoiding the error-prone drive mapping, (writing directly to a UNC path is the recommended alternative).

    Your code appears to be somewhat fragile, but I suppose it could work.

            If your eyes hurt after you drink coffee, you have to take the spoon out of the cup.
                  -Norm Crosby

      Thank you for reply. I have tried to use the UNC path "\\store\projectnew$" in my script ,but script has error for "$" that is used in the UNC path. My question is that,
      1>how can use the UNC path that has $ sign at the end.
      2>I want to verify UNC path for write access to the user.
      thank you. SMW11

        I think you may be running into trouble due to interpolation of both the backslash (which needs to be escaped, and the $, which also needs to be escaped.

        Try entering the UNC path as:

        my $path = "\\\\store\\projectnew\$";

                What is the sound of Perl? Is it not the sound of a wall that people have stopped banging their heads against?
                      -Larry Wall, 1992

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://1072321]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others goofing around in the Monastery: (3)
As of 2024-04-19 17:51 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found