| | |
Windows Script Host question (WSH logon script)
![]() |
•
•
Join Date: Jan 2006
Posts: 3
Reputation:
Solved Threads: 0
Hi ,
Im REAL new with VB and scripting. Im more into networking. I have about 4 departments. I want to MAP the users to their shared drives on the network, and I also want to map their My Documents folder to their shared drive on the network. How do I do that? I found the following snippet on microsoft:
Const ENGINEERING_GROUP = "cn=engineering"
Const FINANCE_GROUP = "cn=finance"
Const HUMAN_RESOURCES_GROUP = "cn=human resources"
Set wshNetwork = CreateObject("WScript.Network")
wshNetwork.MapNetworkDrive "h:",
"\\FileServer\Users\" & wshNetwork.UserName
Set ADSysInfo = CreateObject("ADSystemInfo")
Set CurrentUser = GetObject("LDAP://" &
ADSysInfo.UserName)
strGroups = LCase(Join(CurrentUser.MemberOf))
If InStr(strGroups, ENGINEERING_GROUP) Then
wshNetwork.MapNetworkDrive "g:",
"\\FileServer\Engineering\"
wshNetwork.AddWindowsPrinterConnection
"\\PrintServer\EngLaser"
wshNetwork.AddWindowsPrinterConnection
"\\PrintServer\Plotter"
wshNetWork.SetDefaultPrinter
"\\PrintServer\EngLaser"
ElseIf InStr(strGroups, FINANCE_GROUP) Then
wshNetwork.MapNetworkDrive "g:",
"\\FileServer\Finance\"
wshNetwork.AddWindowsPrinterConnection
"\\PrintServer\FinLaser"
wshNetWork.SetDefaultPrinter
"\\PrintServer\FinLaser"
ElseIf InStr(strGroups, HUMAN_RESOURCES_GROUP) Then
wshNetwork.MapNetworkDrive "g:",
"\\FileServer\Human Resources\"
wshNetwork.AddWindowsPrinterConnection
"\\PrintServer\HrLaser"
wshNetWork.SetDefaultPrinter
"\\PrintServer\HrLaser"
End If
My info:
Departments:
IT
QA
Finance
Engineering
Executive
Fileserver:
Neptune1
Nas1
I will use Group Policy in AD to implement this. All users have 2000 or XP. So I want to look at the department, and MAP users to their drives. Can someone modify the code for me to reflect that?
Thanks
Im REAL new with VB and scripting. Im more into networking. I have about 4 departments. I want to MAP the users to their shared drives on the network, and I also want to map their My Documents folder to their shared drive on the network. How do I do that? I found the following snippet on microsoft:
Const ENGINEERING_GROUP = "cn=engineering"
Const FINANCE_GROUP = "cn=finance"
Const HUMAN_RESOURCES_GROUP = "cn=human resources"
Set wshNetwork = CreateObject("WScript.Network")
wshNetwork.MapNetworkDrive "h:",
"\\FileServer\Users\" & wshNetwork.UserName
Set ADSysInfo = CreateObject("ADSystemInfo")
Set CurrentUser = GetObject("LDAP://" &
ADSysInfo.UserName)
strGroups = LCase(Join(CurrentUser.MemberOf))
If InStr(strGroups, ENGINEERING_GROUP) Then
wshNetwork.MapNetworkDrive "g:",
"\\FileServer\Engineering\"
wshNetwork.AddWindowsPrinterConnection
"\\PrintServer\EngLaser"
wshNetwork.AddWindowsPrinterConnection
"\\PrintServer\Plotter"
wshNetWork.SetDefaultPrinter
"\\PrintServer\EngLaser"
ElseIf InStr(strGroups, FINANCE_GROUP) Then
wshNetwork.MapNetworkDrive "g:",
"\\FileServer\Finance\"
wshNetwork.AddWindowsPrinterConnection
"\\PrintServer\FinLaser"
wshNetWork.SetDefaultPrinter
"\\PrintServer\FinLaser"
ElseIf InStr(strGroups, HUMAN_RESOURCES_GROUP) Then
wshNetwork.MapNetworkDrive "g:",
"\\FileServer\Human Resources\"
wshNetwork.AddWindowsPrinterConnection
"\\PrintServer\HrLaser"
wshNetWork.SetDefaultPrinter
"\\PrintServer\HrLaser"
End If
My info:
Departments:
IT
QA
Finance
Engineering
Executive
Fileserver:
Neptune1
Nas1
I will use Group Policy in AD to implement this. All users have 2000 or XP. So I want to look at the department, and MAP users to their drives. Can someone modify the code for me to reflect that?
Thanks
•
•
Join Date: Jan 2007
Posts: 2
Reputation:
Solved Threads: 0
It's much more easier to do these exact things with scriptlogic's tool - desktop authority.
It's a gui based scripting solution and you can pervent yourself from possible mistakes and issues.
It's a gui based scripting solution and you can pervent yourself from possible mistakes and issues.
![]() |
Similar Threads
- windows script host - help me pls (HTML and CSS)
- Logon Script - Default, forced, compulsory,etc.etc. (Windows NT / 2000 / XP)
Other Threads in the Windows NT / 2000 / XP Forum
- Previous Thread: Screen contantly at 640x480 need drivers
- Next Thread: Belkin wireless F5D7633uk4
| Thread Tools | Search this Thread |
.net 3.5 3daccelertion 2007 2010 a.exe alaris apache application appstore arm auto automatically black blue book cellphones collaboration computer computerfreezes crash cursor deployment desktop desktops dns domain dotnetnuke drive eartlink error errors features folder fontmanagers fonts format framework gadgets intel interoperability killprocess laptop latitude linux load login mac microsoft minimalizes mobile monitor motionle1600 netbooks novell nvidia open operatingsystems osx outlook palm partition patch printer product raid rds remotedesktop remotedesktopconnection repair replacingraiddrive retrieve screen server. simplifiedchinese sp1 unreadable update usb verizon videodrivers videogames virtual virus vista visual vulnerability wab webos weecam win win32/heur window windows windows7 windowsxp windowsxpnotstartingup. worm xp xpde






