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") ; } }
In reply to Re^2: How to access Storage hidden share
by smw11
in thread How to access Storage hidden share
by smw11
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |