VBScript - NT Authentication Script

Posted on 2004-11-22
Last Modified: 2008-01-09
I didn't see topic that covered VBScript specifically so hopefully you all can help me here.

This is the situation:  I have Windows 2000 Professional clients on a Windows Server 2003 domain and would like to create a script that will map drives to a server in a Windows NT 4.0 domain.  

The first script I wrote says that "access is denied."  I need to add to the script the ability to enter the NT domain's User Name and Password.

Notes: There is no trust between the domains and the Usernames are different between domains for the same person (bob's username in NT = admin2, bob's username in 2003 = bsmith).

If anyone can help, I would greatly appreciate it.
Question by:acksis

    Author Comment

    Another note - we've considered adding the trust between domains but that would also include adding the 2003 user groups to the NTFS permissions on the old domain.  That sounded like considerably more work and decided against it.
    LVL 76

    Accepted Solution

    If "... the ability to enter the NT domain's User Name and Password" means you want the user to be prompted for a username and password, then the script below will do that.

        Dim objNetwork, strLetter, strRemoteShare, strUserName, strPassword
        strLetter = "Z:"
        strRemoteShare = "\\Server\Share"
        strUserName = InputBox("Enter your username", "Username")
        strPassword = InputBox("Enter the password for " & strUserName, "Password")
        Set objNetwork = CreateObject("Wscript.Network")
        objNetwork.MapNetworkDrive strLetter, strRemoteShare, , strUserName, strPassword
        Set objNetwork = Nothing

    Author Comment

    that works - thanks

    Write Comment

    Please enter a first name

    Please enter a last name

    We will never share this with anyone.

    Featured Post

    How your wiki can always stay up-to-date

    Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
    - Increase transparency
    - Onboard new hires faster
    - Access from mobile/offline

    Suggested Solutions

    Article by: Martin
    Here are a few simple, working, games that you can use as-is or as the basis for your own games. Tic-Tac-Toe This is one of the simplest of all games.   The game allows for a choice of who goes first and keeps track of the number of wins for…
    Enums (shorthand for ‘enumerations’) are not often used by programmers but they can be quite valuable when they are.  What are they? An Enum is just a type of variable like a string or an Integer, but in this case one that you create that contains…
    Get people started with the utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…
    Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…

    758 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    10 Experts available now in Live!

    Get 1:1 Help Now