Net use command in Windows NT 4

Posted on 2004-11-20
Last Modified: 2007-12-19
Dear all experts,

  I've some question regarding the net use command in Windows NT4, please kindly advice:

  Currently I've 10 NT 4 Workstations and 60 Windows 2000 Professional clients, both of the computers are joinned in my Windows 2003 Active Directory.  I've made a login script for my client to map the network drive when they login to the network, the script is as follow:

  Net Use H: \\Server1\Data > Nul
  Net Use I: \\Server1\Data\Application > Nul
  Net Use J: \\Server1\Data\Application\New > Nul
  Net Use K: \\Server1\Document > Nul
  Net Use L: \\Server1\Document\IT > Nul
  Net Use M: \\Server1\Document\Human > Nul

  Where \\Server\Data and \\Server1\Document are the share folder in my network.
  And Application is the subfolders under "Document" share

  When the clients login on the Windows 2000 Professional machine, it can map all the network drives (H, I, J, K, L, M).  However, when the clients login on the Windows NT4 workstatoin, it can mapped to H and K drive.  I think the problem is the net use command provided by Windows NT4 cannot map to network share folder directly.  

  Therefore, can any experts tell me how to override the above problem.  How do I re-write my login script?  Please advice.

  Futhermore, I would like to know how to detemind the OS version in login script.

Thounsand Thanks!

Question by:LegalIT
    LVL 2

    Expert Comment

    Windows 2000 and above supports deep root mapping, this means that you can map a drive to any folder beneth a share.  NT can't do this so you could share each folder, eg share application and share document.

    then update the script to read:

     Net Use H: \\Server1\Data > Nul
     Net Use I: \\Server1\Application > Nul
     Net Use J: \\Server1\New > Nul
     Net Use K: \\Server1\Document > Nul
     Net Use L: \\Server1\IT > Nul
     Net Use M: \\Server1\Human > Nul
    LVL 2

    Expert Comment

    For determining OS here is a vbscript:

    '========= Declarations =================
    Option Explicit

    'Define variables
    Dim sOStype
    Dim iRetVal

    '========= Main code =================

    'Display a string for OS type rather than a number
    iRetVal = GetOSType
    Select Case iRetVal
        Case 0
            sOStype = "Not found"
        Case 1
            sOStype = "Windows 95"
        Case 2
            sOStype = "Windows 98"
        Case 3
            sOStype = "Windows Me"
        Case 4
            sOStype = "Windows NT"
        Case 5
            sOStype = "Windows 2000"
        Case 6
            sOStype = "Windows XP"
    End Select
    '========= Procedures and functions ==============

    Function GetOSType
        'Declare local variables
        Dim sOSType    'Temp variable to store values from registry
        Dim oWshShell    'Needs the Shell object to access registry

        Set oWshShell = WScript.CreateObject("WScript.Shell")
        GetOSType = 0

        'Get OS Info from registry
        On Error Resume Next
            'Initially assume Win9x platform
            sOSType = oWshShell.RegRead("HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Version")

            If sOSType = Empty Then
                'If variable still empty then NT platform is used
                'Read version from registry to find type of NT platform
                '    "CurrentVersion"="4.0"
                '    "CurrentVersion"="5.0"
                sOSType = Trim(oWshShell.RegRead("HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\CurrentVersion"))
                If sOSType = "5.1" Then
                    'Windows XP
                    GetOSType = 6            
                ElseIf sOSType = "5.0" Then
                    'Windows 2000
                    GetOSType = 5
                ElseIf sOSType = "4.0" Then
                    'Windows NT 4.0
                    GetOSType = 4
                End If
                'Find type of Win9x platform
                '    "Version"="Windows 98"
                '    "Version"="Windows 95"
                '    "Version"="Windows Millennium Edition"
                If InStr(1,sOSType,"Millennium Edition",1) > 0 Then
                    'Windows Me
                    GetOSType = 3
                ElseIf InStr(1,sOSType,"98",0) > 0 Then
                    'Windows 98
                    GetOSType = 2
                ElseIf InStr(1,sOSType,"95",0) > 0 Then
                    'Windows 95
                    GetOSType = 1
                End If
            End If
        On Error Goto 0

        'Clean up
        Set oWshShell = Nothing
    End Function

    LVL 9

    Accepted Solution

    You might be able to do that all in an MSDOS script, try this:

    :----8<----------------------------- FileName.bat ------------------------------------:

    FOR /F "tokens=3 delims= " %%C in ('ver') do IF /I "%%C" NEQ "NT" GOTO :NOT_NT

     Net Use H: \\Server1\Data > Nul
     Net Use I: \\Server1\Application > Nul
     Net Use J: \\Server1\New > Nul
     Net Use K: \\Server1\Document > Nul
     Net Use L: \\Server1\IT > Nul
     Net Use M: \\Server1\Human > Nul


    ECHO The detected OS does not appear to be Windows NT...

      Net Use H: \\Server1\Data > Nul
      Net Use I: \\Server1\Data\Application > Nul
      Net Use J: \\Server1\Data\Application\New > Nul
      Net Use K: \\Server1\Document > Nul
      Net Use L: \\Server1\Document\IT > Nul
      Net Use M: \\Server1\Document\Human > Nul

    ECHO complete.
    :----8<----------------------------- FileName.bat ------------------------------------:

    Good luck,
    LVL 9

    Expert Comment

    8-) Thanks.
    LVL 5

    Expert Comment

    Or try

    subst J: \\Server1\Data\Application\New > Nul

    iirc this works on NT4, but I'm a bit rusty.

    Write Comment

    Please enter a first name

    Please enter a last name

    We will never share this with anyone.

    Featured Post

    How to run any project with ease

    Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
    - Combine task lists, docs, spreadsheets, and chat in one
    - View and edit from mobile/offline
    - Cut down on emails

    Hello I read in a discussion about a person who configured a very simple mirror RAID with two hard drives; the system and data were on the same partition. He asked how to repair the system as it was not booting up anymore. In his case running …
    I. Introduction There's an interesting discussion going on now in an Experts Exchange Group — Attachments with no extension ( This reminded me of questions tha…
    In this seventh video of the Xpdf series, we discuss and demonstrate the PDFfonts utility, which lists all the fonts used in a PDF file. It does this via a command line interface, making it suitable for use in programs, scripts, batch files — any pl…
    Get a first impression of how PRTG looks and learn how it works.   This video is a short introduction to PRTG, as an initial overview or as a quick start for new PRTG users.

    760 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

    13 Experts available now in Live!

    Get 1:1 Help Now