944,167 Members | Top Members by Rank

Ad:
Jan 11th, 2006
0

Windows Script Host question (WSH logon script)

Expand Post »
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
Similar Threads
Reputation Points: 10
Solved Threads: 0
Newbie Poster
mujtba is offline Offline
3 posts
since Jan 2006
Jan 30th, 2007
0

Re: Windows Script Host question (WSH logon script)

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.
Reputation Points: 10
Solved Threads: 0
Newbie Poster
Humanvoice is offline Offline
2 posts
since Jan 2007
Jan 30th, 2007
0

Re: Windows Script Host question (WSH logon script)

cant you do this through user/group policy?
Moderator
Featured Poster
Reputation Points: 1800
Solved Threads: 575
Moderator
jbennet is offline Offline
16,534 posts
since Apr 2005
Jan 30th, 2007
0

Re: Windows Script Host question (WSH logon script)

it's all easily done with gpmc, scripting, IMO, is for more complex tasks
Moderator
Featured Poster
Reputation Points: 183
Solved Threads: 89
Posting Virtuoso
DimaYasny is offline Offline
1,772 posts
since Jan 2007

This thread is more than three months old

No one has posted to this discussion for at least three months. Please let old threads die and do not reply to them unless you feel you have something new and valuable to contribute that absolutely must be added to make the discussion complete. Otherwise, please start a new thread in this forum instead.
Message:
Previous Thread in Windows NT / 2000 / XP Forum Timeline: Screen contantly at 640x480 need drivers
Next Thread in Windows NT / 2000 / XP Forum Timeline: Belkin wireless F5D7633uk4





About Us | Contact Us | Advertise | Acceptable Use Policy
Forum Index | Build Custom RSS Feed


Follow us on Twitter


© 2011 DaniWeb® LLC