Solved

Login Script

Posted on 2011-02-14
1
421 Views
Last Modified: 2012-05-11
I know it is in here some were but I can not find it.  I need help to develop a login script for users in groups and sub groups.  

I am using nested groups and need a better way to find out what groups a user belongs to that way I came up with seems too complicated.

If I try to use
Const DEP = "cn=01-0#-00"
to map a departmental drive or printer I do not get any response.  "cn=01-0#-00" only contains groups not any users.  

The actual groups that users are in look like this
Const FAC-A = "cn=01-0#-01-0A"
or
Const STA-A = "cn=01-0#-02-0A"
or
Const STU-A = "cn=01-0#-09-0A"
if I map a drive or printer to one of these I get great results but then I repeated code for department or devision shared resources.

here is my structure:
All staff members for a give department are put into these groups:
Const STA-A = "cn=01-0#-02-0A"
Const STA-B = "cn=01-0#-02-0B"
Const STA-C = "cn=01-0#-02-0C"
Const STA-D = "cn=01-0#-02-0D"
Const STA-E = "cn=01-0#-02-0E"
Const STA-F = "cn=01-0#-02-0F"

All of the staff groups for a give division are put into this group:
Const STA = "cn=01-0#-02-00"
This group "cn=01-0#-02-00" is also a member of the divisions all users group.

Is there a way to determine the groups a user belongs to when the login and then from that information map drives and assign printers?

DC-Windows 2008r2
Workstations are XP and Win7
will be applied as part of a GPO

I hope I gave enough info for someone to be able to help.  Been at this for a few hours now and my eyes are giving out.

 
'========================================================================
' AUTHOR:  Mike Land 
' COMPANY: Cypress college
' COMMENT: Master Login script
'=========================================================================

Dim Network
Dim ADSysInfo
Dim CurrentUser
Dim Groups
Dim Strgroups

'Department
Const DEP = "cn=01-0#-00"

'All FAC- Groups
Const FAC = "cn=01-0#-01-00"
Const FAC-A = "cn=01-0#-01-0A"
Const FAC-B = "cn=01-0#-01-0B"
Const FAC-C = "cn=01-0#-01-0C"
Const FAC-D = "cn=01-0#-01-0D"
Const FAC-E = "cn=01-0#-01-0E"
Const FAC-F = "cn=01-0#-01-0F"

'All Staff Groups
Const STA = "cn=01-0#-02-00"
Const STA-A = "cn=01-0#-02-0A"
Const STA-B = "cn=01-0#-02-0B"
Const STA-C = "cn=01-0#-02-0C"
Const STA-D = "cn=01-0#-02-0D"
Const STA-E = "cn=01-0#-02-0E"
Const STA-F = "cn=01-0#-02-0F"

'All Students Groups
Const STU = "cn=01-0#-09-00"
Const STU-A = "cn=01-0#-09-0A"
Const STU-B = "cn=01-0#-09-0B"
Const STU-C = "cn=01-0#-09-0C"
Const STU-D = "cn=01-0#-09-0D"
Const STU-E = "cn=01-0#-09-0E"
Const STU-F = "cn=01-0#-09-0F"

'wScript.echo "1"

Set ADSysInfo = CreateObject("ADSystemInfo")
Set CurrentUser = GetObject("LDAP://" & ADSysInfo.UserName)
strGroups = LCase(Join(CurrentUser.MemberOf))

'Department Home Drive Mappings
Set wshNetwork = CreateObject("WScript.Network")
  wshNetwork.MapNetworkDrive "H:", "\\ccfs-01a\0#-HOMEDRIVE\" & wshNetwork.UserName, blnPersistent

'Departmental Printer and Drive Mappings
If InStr(strGroups, FAC) Or InStr(strGroups, STA) Then
	wshNetwork.MapNetworkDrive "I:", "\\ccfs-01a\0#-Drive"
	wshNetwork.MapNetworkDrive "J:", "\\ccfs-01a\J-Drive"
	wshNetwork.AddWindowsPrinterConnection "\\CCPS-01a\C06-100-2D2-P01"
End If

'Faculity specific login peramaters
If InStr(strGroups, FAC-A) Or InStr(strGroups, FAC-B) Or InStr(strGroups, FAC-C) Or InStr(strGroups, FAC-D) Or InStr(strGroups, FAC-E) Or InStr(strGroups, FAC-F) Then
	wshNetwork.AddWindowsPrinterConnection "\\CCPS-01a\C##-###-###-P##"

	If InStr(strGroups, FAC-A) Then
		wshNetwork.AddWindowsPrinterConnection "\\CCPS-01a\C##-###-###-P##"
	End If
	
	If InStr(strGroups, FAC-B) Then
		wshNetwork.AddWindowsPrinterConnection "\\CCPS-01a\C##-###-###-P##"	
	End If
	
	If InStr(strGroups, FAC-C) Then
		wshNetwork.AddWindowsPrinterConnection "\\CCPS-01a\C##-###-###-P##"	
	End If
	
	If InStr(strGroups, FAC-D) Then
		wshNetwork.AddWindowsPrinterConnection "\\CCPS-01a\C##-###-###-P##"	
	End If
	
	If InStr(strGroups, FAC-E) Then
		wshNetwork.AddWindowsPrinterConnection "\\CCPS-01a\C##-###-###-P##"	
	End If
	
	If InStr(strGroups, FAC-F) Then
		wshNetwork.AddWindowsPrinterConnection "\\CCPS-01a\C##-###-###-P##"	
	End If
End If

'Staff specific Peramiters
If InStr(strGroups, STA-A) Or InStr(strGroups, STA-B) Or InStr(strGroups, STA-C) Or InStr(strGroups, STA-D) Or InStr(strGroups, STA-E) Then
	wshNetWork.SetDefaultPrinter "\\CCPS-01a\C06-100-2D2-P01"
		
	If InStr(strGroups, STA-A) Then
		wshNetwork.AddWindowsPrinterConnection "\\CCPS-01a\C##-###-###-P##"	
	End If
		
	If InStr(strGroups, STA-B) Then
		wshNetwork.AddWindowsPrinterConnection "\\CCPS-01a\C##-###-###-P##"	
	End If
		
	If InStr(strGroups, STA-C) Then
		wshNetwork.AddWindowsPrinterConnection "\\CCPS-01a\C##-###-###-P##"	
	End If
		
	If InStr(strGroups, STA-D) Then
		wshNetwork.AddWindowsPrinterConnection "\\CCPS-01a\C##-###-###-P##"	
	End If
			
	If InStr(strGroups, STA-F) Then
		wshNetwork.AddWindowsPrinterConnection "\\CCPS-01a\C##-###-###-P##"	
	End If

End If

'Student specific paramiters
If InStr(strGroups, STU-A) Or InStr(strGroups, STU-B) Or InStr(strGroups, STU-C) Or InStr(strGroups, STU-D) Or InStr(strGroups, STU-E) Or InStr(strGroups, STU-F) Then
	'wshNetwork.AddWindowsPrinterConnection "\\CCPS-01a\C##-###-###-P##"
		
	If InStr(strGroups, STU-A) Then
		wshNetwork.AddWindowsPrinterConnection "\\CCPS-01a\C##-###-###-P##"	
	End If
	If InStr(strGroups, STU-B) Then
		wshNetwork.AddWindowsPrinterConnection "\\CCPS-01a\C##-###-###-P##"	
	End If
	If InStr(strGroups, STU-C) Then
		wshNetwork.AddWindowsPrinterConnection "\\CCPS-01a\C##-###-###-P##"	
	End If
	If InStr(strGroups, STU-D) Then
		wshNetwork.AddWindowsPrinterConnection "\\CCPS-01a\C##-###-###-P##"	
	End If
	If InStr(strGroups, STU-E) Then
		wshNetwork.AddWindowsPrinterConnection "\\CCPS-01a\C##-###-###-P##"	
	End If
	If InStr(strGroups, STU-F) Then
		wshNetwork.AddWindowsPrinterConnection "\\CCPS-01a\C##-###-###-P##"	
	End If
End If

Open in new window

0
Comment
Question by:Michael_Land
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
1 Comment
 
LVL 65

Accepted Solution

by:
RobSampson earned 500 total points
ID: 34893844
Hi, here's a script that will list the groups recursively:
http://www.experts-exchange.com/Programming/Languages/Visual_Basic/VB_Script/Q_24243636.html

which I think is what you need for this?

Regards,

Rob.
0

Featured Post

Free NetCrunch network monitor licenses!

Only on Experts-Exchange: Sign-up for a free-trial and we'll send you your permanent license!

Here is what you get: 30 Nodes | Unlimited Sensors | No Time Restrictions | Absolutely FREE!

Act now. This offer ends July 14, 2017.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Background Information Recently I have fixed file server permission issues for one of my client. The client has 1800 users and one Windows Server 2008 R2 domain joined file server with 12 TB of data, 250+ shared folders and the folder structure i…
A company’s centralized system that manages user data, security, and distributed resources is often a focus of criminal attention. Active Directory (AD) is no exception. In truth, it’s even more likely to be targeted due to the number of companies …
This tutorial will walk an individual through the process of transferring the five major, necessary Active Directory Roles, commonly referred to as the FSMO roles from a Windows Server 2008 domain controller to a Windows Server 2012 domain controlle…
There are cases when e.g. an IT administrator wants to have full access and view into selected mailboxes on Exchange server, directly from his own email account in Outlook or Outlook Web Access. This proves useful when for example administrator want…

728 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question