Hello, complete VBeginner here. I have managed to the create the two following scripts that do what I need but I don't know how to get them to be in the same script file so I don't need two. Below are the scripts:
Script 1: On Error Resume Next
Set objSysInfo = CreateObject("ADSystemInfo")
Set objNetwork = CreateObject("Wscript.Network")
'find user name
strUserPath = "LDAP://" & objSysInfo.UserName
Set objUser = GetObject(strUserPath)
'find user group's
For Each strGroup in objUser.MemberOf
strGroupPath = "LDAP://" & strGroup
Set objGroup = GetObject(strGroupPath)
strGroupName = objGroup.CN
'if user member of a group then map network drive
Select Case strGroupName
Case "Arm-All_Users"
objNetwork.MapNetworkDrive "N", "\\ukarmf02\pccommon"
Case "Dub-All_Users"
objNetwork.MapNetworkDrive "N", "\\ukdubfp02\groups\pccommon"
Case "BK-UK-Dublin-AcCommon"
objNetwork.MapNetworkDrive "P", "\\ukdubfp02\groups\accommon"
Case "BK-UK-Otley-All_Users"
objNetwork.MapNetworkDrive "N", "\\ukotlfp02\pccommon"
Case "BK-UK-Otley-SCCommon"
objNetwork.MapNetworkDrive "J", "\\ukotlfp02\sccommon"
End Select
Next
Script 2: Option Explicit
'Variable for shell object
Dim wshShell
'Variable for redirecting Folders
Dim strFavoriteRedirectRegKey
Dim strFavoriteRedirectLocation
Dim strFavoriteRedirectRegType
Dim strFavoriteRedirectRegKey2
Dim strFavoriteRedirectLocation2
Dim strFavoriteRedirectRegType2
Dim strPicturesRedirectRegKey
Dim strPicturesRedirectLocation
Dim strPicturesRedirectRegType
Dim strPicturesRedirectRegKey2
Dim strPicturesRedirectLocation2
Dim strPicturesRedirectRegType2
Dim strDocumentsRedirectRegKey
Dim strDocumentsRedirectLocation
Dim strDocumentsRedirectRegType
Dim strDocumentsRedirectRegKey2
Dim strDocumentsRedirectLocation2
Dim strDocumentsRedirectRegType2
Dim strSyncMgrInitializedRegKey
Dim strSyncMgrInitializedLocation
Dim strSyncMgrInitializedRegType
Dim strNoRemindersRegKey
Dim strNoRemindersLocation
Dim strNoRemindersRegType
'CREATE GLOBAL OBJECTS
Set wshShell = CreateObject("WScript.Shell")
'Folder Redirection Registry Info
strFavoriteRedirectRegKey = "HKCU\Software\Microsoft\Windows\CurrentVersion\Explorer\Shell Folders\Favorites"
strFavoriteRedirectLocation = "I:\redirectTest\Favorites"
strFavoriteRedirectRegType = "REG_SZ"
strFavoriteRedirectRegKey2 = "HKCU\Software\Microsoft\Windows\CurrentVersion\Explorer\User Shell Folders\Favorites"
strFavoriteRedirectLocation2 = "I:\redirectTest\Favorites"
strFavoriteRedirectRegType2 = "REG_EXPAND_SZ"
strPicturesRedirectRegKey = "HKCU\Software\Microsoft\Windows\CurrentVersion\Explorer\Shell Folders\My Pictures"
strPicturesRedirectLocation = "I:\redirectTest\My Pictures"
strPicturesRedirectRegType = "REG_SZ"
strPicturesRedirectRegKey2 = "HKCU\Software\Microsoft\Windows\CurrentVersion\Explorer\User Shell Folders\My Pictures"
strPicturesRedirectLocation2 = "I:\redirectTest\My Pictures"
strPicturesRedirectRegType2 = "REG_EXPAND_SZ"
strDocumentsRedirectRegKey = "HKCU\Software\Microsoft\Windows\CurrentVersion\Explorer\Shell Folders\Personal"
strDocumentsRedirectLocation = "I:\redirectTest\My Documents"
strDocumentsRedirectRegType = "REG_SZ"
strDocumentsRedirectRegKey2 = "HKCU\Software\Microsoft\Windows\CurrentVersion\Explorer\User Shell Folders\Personal"
strDocumentsRedirectLocation2 = "I:\redirectTest\My Documents"
strDocumentsRedirectRegType2 = "REG_EXPAND_SZ"
strSyncMgrInitializedRegKey = "HKCU\Software\Microsoft\Windows\CurrentVersion\NetCache\SyncMgrInitialized"
strSyncMgrInitializedLocation = "1"
strSyncMgrInitializedRegType = "REG_DWORD"
strNoRemindersRegKey = "HKCU\Software\Microsoft\Windows\CurrentVersion\NetCache\NoReminders"
strNoRemindersLocation = "0"
strNoRemindersRegType = "REG_DWORD"
'Redirect Folders by writing registry entry.
wshShell.RegWrite strFavoriteRedirectRegKey, strFavoriteRedirectLocation, strFavoriteRedirectRegType
wshShell.RegWrite strFavoriteRedirectRegKey2, strFavoriteRedirectLocation2, strFavoriteRedirectRegType2
wshShell.RegWrite strPicturesRedirectRegKey, strPicturesRedirectLocation, strPicturesRedirectRegType
wshShell.RegWrite strPicturesRedirectRegKey2, strPicturesRedirectLocation2, strPicturesRedirectRegType2
wshShell.RegWrite strDocumentsRedirectRegKey, strDocumentsRedirectLocation, strDocumentsRedirectRegType
wshShell.RegWrite strDocumentsRedirectRegKey2, strDocumentsRedirectLocation2, strDocumentsRedirectRegType2
wshShell.RegWrite strSyncMgrInitializedRegKey, strSyncMgrInitializedLocation, strSyncMgrInitializedRegType
wshShell.RegWrite strNoRemindersRegKey, strNoRemindersLocation, strNoRemindersRegType