Announcement

Collapse
No announcement yet.

Script for maping a network share

Collapse
X
  • Filter
  • Time
  • Show
Clear All
new posts

  • Script for maping a network share

    Hi Team,

    I need a Perl script for maping a network share.
    i will give the hostname and the username and password as inputs
    to this script.Please guide me.

    Thanks and regards
    krishna

  • #2
    Re: Script for maping a network share

    You want servers any drive for each user?plz explain properly.

    Comment


    • #3
      Re: Script for maping a network share

      Originally posted by krishna.rb View Post
      I need a Perl script for maping a network share.
      Perl is way overkill for such a simple task. Google for "windows map network drive perl"

      The first hit seems good enough:
      http://techtasks.com/code/viewbookcode/1086 - although it just uses OLE to create a Windows scripting API call to Wscript.Network.MapNetworkDrive(). Sure Perl makes it easy to parse the input, but we are not talking about rocket science here. I'd advise you to stick with batch files or VBScript unless you really do have a business case to use Perl.

      Code:
      use Win32::OLE;
      
      $strDrive = '<Drive>';
      # e.g. N:
      $strPath = '<Path>';
      # e.g. \\rtp01\c$\temp
      $strUser = '<User>';
      # e.g. AMER\rallen
      $strPassword = '<Password>';
      $boolPersistent = 1;
      # True = Persistent ; False = Not Persistent
      # ------ END CONFIGURATION ---------
      $objNetwork = Win32::OLE->new('WScript.Network');
      $objNetwork->MapNetworkDrive($strDrive, $strPath, $boolPersistent, $strUser, $strPassword);
      print "Successfully mapped drive\n";
      -vP

      Comment


      • #4
        Re: Script for maping a network share

        thanks alot
        Vonprys

        Comment

        Working...
        X