Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Option Explicit
- ' Declare Variables
- Dim Answer
- Dim ObjNetwork, objUser
- Dim strUserName
- Dim WshShell, objFSO, strUserProfile, source, destination
- Dim objSysInfo, strUserPath
- Dim strGroup, strGroupName, objGroup, strGroupPath
- ' Set Variables for Functions
- Set objNetwork = CreateObject("WScript.Network")
- Set WshShell = WScript.CreateObject("WScript.Shell")
- Set objFSO = CreateObject("Scripting.FileSystemObject")
- Set objSysInfo = CreateObject("ADSystemInfo")
- strUserPath = "LDAP://" & objSysInfo.UserName
- Set objUser = GetObject(strUserPath)
- Set objSysInfo = CreateObject("ADSystemInfo")
- ' Set Variables for User Information
- strUserName = objNetwork.UserName
- Answer=msgbox(strUserName)
- strUserProfile = wshShell.ExpandEnvironmentStrings("%USERPROFILE%")
- 'Call Functions
- RemoveDrives()
- CreateShortcut()
- GetGroup()
- Function GetGroup()
- For Each strGroup in objUser.MemberOf
- strGroupPath = "LDAP://" & strGroup
- Set objGroup = GetObject(strGroupPath)
- strGroupName = objGroup.CN
- Select Case strGroupName
- Case "NoAccess"
- objNetwork.MapNetworkDrive "t:", "\\DC2\VLFCU Policies"
- Exit Function
- Case "Card Dept"
- objNetwork.MapNetworkDrive "m:", "\\dc2\Data\Shared\Card Department\Apps"
- GeneralMapDrives()
- Case "Cardsource"
- objNetwork.MapNetworkDrive "m:", "\\dc2\Data\Shared\Card Department\Apps"
- GeneralMapDrives()
- End Select
- Next
- GeneralMapDrives()
- End Function
- Function RemoveDrives()
- Answer=MsgBox("Remove Drives Function Called")
- On Error Resume Next
- '_____/Drives mapped for all users (deletes, then re-maps)\_____
- objNetwork.RemoveNetworkDrive "f:"
- objNetwork.RemoveNetworkDrive "g:"
- objNetwork.RemoveNetworkDrive "h:"
- objNetwork.RemoveNetworkDrive "j:"
- objNetwork.RemoveNetworkDrive "m:"
- objNetwork.RemoveNetworkDrive "q:"
- objNetwork.RemoveNetworkDrive "u:"
- objNetwork.RemoveNetworkDrive "r:"
- objNetwork.RemoveNetworkDrive "t:"
- Answer2=MsgBox("Remove Drives Function Complete")
- End Function
- Function GeneralMapDrives()
- Answer=MsgBox("General Map Drives Function Called")
- On Error Resume Next
- objNetwork.MapNetworkDrive "f:", "\\dc2\Data\Apps"
- objNetwork.MapNetworkDrive "g:", "\\dc2\Data"
- objNetwork.MapNetworkDrive "h:", "\\dc2\users\" & strUserName
- objNetwork.MapNetworkDrive "j:", "\\dc2\Data\apps\shrclndr"
- objNetwork.MapNetworkDrive "u:", "\\dc2\Users\"
- objNetwork.MapNetworkDrive "r:", "\\edoc\doclogic\edi\cua197\reports"
- Answer2=MsgBox("General Map Drives Function Complete")
- End Function
- Function CreateShortCut()
- source="\\vlfcu.local\sysvol\vlfcu.local\scripts\vlc"
- destination= strUserProfile & "\Desktop"
- Answer=Msgbox(destination)
- If objFSO.FolderExists(source) Then
- objFSO.CopyFolder source, destination
- End If
- End Function
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement