• We’re currently investigating an issue related to the forum theme and styling that is impacting page layout and visual formatting. The problem has been identified, and we are actively working on a resolution. There is no impact to user data or functionality, this is strictly a front-end display issue. We’ll post an update once the fix has been deployed. Thanks for your patience while we get this sorted.

VBScript or Powershell help

Bradtechonline

Senior member
I want a global script for all my users on my network. I want for when it loads on startup to map a user to their resources automatically.. I know how to do this sort of in a batch file. Where %username% is it will map a drive based on what the variable is for the username such as jdoe jsmith etc.. I need a script to do this but for their division they are in such as Human Resources, Garage, IT, Attorneys etc...

net use g: /delete
net use g: \\server\%username%
 
Do you have the division populated in AD (assuming of course that you are using AD) somewhere that you can query to dynamically build the drive mapping?
 
Yes, we will have these created in AD in OUs.. Right now we are in the process of a major switch from an NDS Ring (eDirectory) and NT hybrid domain over to a pure 2008 Server AD domain. I would like for it to query AD, and map shares based on the users group or Organizational Unit.

\\server\%group share%
\\server\%username%
\\server\%group printers%

I would like to have only ONE script, and not a series of scripts to run for each group.. Global.bat or global.vbs

I hate making sub scripts or batches for certain containers.
 
Here is a sample script I use:


If IsOrgUnitMember("Division") Then
'map share drive
Set wshNetwork = CreateObject("WScript.Network")

WshNetwork.MapNetworkDrive "H:", "\\server\divisionshare", False
End If



Function IsOrgUnitMember(OUName)
Dim ADSysInfo
Set ADSysInfo = CreateObject("ADSystemInfo")
If Instr(1,ucase(ADSysInfo.UserName),Ucase("OU=" & OUName)) > 0 Then
IsOrgUnitMember = true
Else
IsOrgUnitMember = False
End If

Set ADSysInfo = Nothing
End Function


Here is another good resource for scripts:

http://cwashington.netreach.net/
 
Back
Top