none
Network drive mapping using %username% is not working RRS feed

  • Question

  • Hi,

    I've migrating domain A to domain B.
    For some reasons, file server from domain A will stay in this domain and will not be migrated.

    I've migrated my users to domain B, and re apply my script for network drive mapping.

    my script (vbs) is launched from a batch file, and a boucle is searching the differents drives to map. 
    So for one user, i've got 5 drives, and the last is his personal drive.

    To map personal drive for an user, I'm using %username% parameter in my script but for this drive only, it doesn't work.
    My code is :

     

    For Each xmlgroup in xmlGroups.selectNodes("//GROUPS/GROUP")
     sNom = xmlgroup.selectSingleNode("NOM").nodeTypedValue
     sLettre = xmlgroup.selectSingleNode("LETTRE").nodeTypedValue
     sChemin = xmlgroup.selectSingleNode("CHEMIN").nodeTypedValue

     if InGroup(sNom) then
      WshNetwork.MapNetworkDrive TestLettre(sLettre), sChemin, True
     end if
    Next

    In sChemin which is the path, i've got a code like : "\\SRV1\USERS\%username%

    Do you have any idea ?

    Regards

    Thursday, May 12, 2016 7:59 AM

Answers

  • You cannot use batch variables in VBScript.

    Use Group Policy to assign drives.  We no longer do this with script since GP was implemented in Windows 2000 Active Directory.


    \_(ツ)_/

    • Marked as answer by Frédéric.G Thursday, May 12, 2016 9:45 AM
    Thursday, May 12, 2016 9:09 AM

All replies

  • You cannot use batch variables in VBScript.

    Use Group Policy to assign drives.  We no longer do this with script since GP was implemented in Windows 2000 Active Directory.


    \_(ツ)_/

    • Marked as answer by Frédéric.G Thursday, May 12, 2016 9:45 AM
    Thursday, May 12, 2016 9:09 AM
  • This is exactly what I was thinking after few tests with a simple script manually launched.

    regards

    • Marked as answer by Frédéric.G Thursday, May 12, 2016 9:46 AM
    • Unmarked as answer by Frédéric.G Thursday, May 12, 2016 9:46 AM
    Thursday, May 12, 2016 9:46 AM