CertForums


Go Back   CertForums > Computing Support Forums > Programming & Scripting


Logon Scripts, lets share and improve

Reply
 
Thread Tools Display Modes
  #1  
Old 11-Aug-2006, 08:59 AM
SiFor's Avatar
SiFor SiFor is offline
Administrator
Posts: 5,100
 
Reputation
Points: 1027 SiFor has over 1000 pointsSiFor has over 1000 pointsSiFor has over 1000 pointsSiFor has over 1000 pointsSiFor has over 1000 pointsSiFor has over 1000 pointsSiFor has over 1000 pointsSiFor has over 1000 points
Power: 74
Awards
None
Profile
Join Date: 23 Jun 2003
Location: Chesterfield, Derbyshire
Certifications: A+, MCSA:M 2003 MCSE 2003
Rep Power: 74
SiFor has over 1000 pointsSiFor has over 1000 pointsSiFor has over 1000 pointsSiFor has over 1000 pointsSiFor has over 1000 pointsSiFor has over 1000 pointsSiFor has over 1000 pointsSiFor has over 1000 points
Logon Scripts, lets share and improve

I'm just about to start work on a VBS logon script that will map printers and shares for my users on our network, I'm looking to install printers on computers based on the active directory OU that they are located and also by user group membership of my users. Im also looking to map drives based on user group membership.

So I wondered before I started this how others accomplished this and the methods they used, maybe we could have a recourse sharing thread and post our scripts and that way we may help others working on their own scripts.

I'll post mine later when I have got it ironed out and tested.

Dont forget to use the code tags when posting your code in the forums

this:
[CODE]code goes here[/CODE]

will look like this:
Code:
code goes here

 
Reply With Quote
  #2  
Old 11-Aug-2006, 09:02 AM
Boycie's Avatar
Boycie Boycie is offline
Senior Beer Tester
Posts: 6,241
 
Reputation
Points: 1794 Boycie has over 1500 pointsBoycie has over 1500 pointsBoycie has over 1500 pointsBoycie has over 1500 pointsBoycie has over 1500 pointsBoycie has over 1500 pointsBoycie has over 1500 pointsBoycie has over 1500 pointsBoycie has over 1500 pointsBoycie has over 1500 pointsBoycie has over 1500 points
Power: 89
Awards
None
Profile
Join Date: 23 Feb 2005
Location: Cardiff
Certifications: MCSA 2003, MCDST, A+, N+, CTT+, MCT
Rep Power: 89
Boycie has over 1500 pointsBoycie has over 1500 pointsBoycie has over 1500 pointsBoycie has over 1500 pointsBoycie has over 1500 pointsBoycie has over 1500 pointsBoycie has over 1500 pointsBoycie has over 1500 pointsBoycie has over 1500 pointsBoycie has over 1500 pointsBoycie has over 1500 points
Something i know nothing about, so look forward to any posts on the matter.

Si

 
Reply With Quote
  #3  
Old 11-Aug-2006, 10:54 AM
SiFor's Avatar
SiFor SiFor is offline
Administrator
Posts: 5,100
 
Reputation
Points: 1027 SiFor has over 1000 pointsSiFor has over 1000 pointsSiFor has over 1000 pointsSiFor has over 1000 pointsSiFor has over 1000 pointsSiFor has over 1000 pointsSiFor has over 1000 pointsSiFor has over 1000 points
Power: 74
Awards
None
Profile
Join Date: 23 Jun 2003
Location: Chesterfield, Derbyshire
Certifications: A+, MCSA:M 2003 MCSE 2003
Rep Power: 74
SiFor has over 1000 pointsSiFor has over 1000 pointsSiFor has over 1000 pointsSiFor has over 1000 pointsSiFor has over 1000 pointsSiFor has over 1000 pointsSiFor has over 1000 pointsSiFor has over 1000 points
Mapping shares based on group membership

Here is my first part, this will map 2 drives G: and H: for every user and four additional drives for two differnet usergroups "technicians" and "admin staff", now I'll add all other groups and the drives that they need to the script follwing the same format. I wont post the full script just parts of it. HTH


Code:
'--------Mapping drives and printer script --------
'--------by SiFor www.certforums.co.uk --------
Option Explicit
On Error Resume Next

Dim DriveLetter1, DriveLetter2, DriveLetter3, DriveLetter4
Dim DriveLetter5, DriveLetter6
Dim RemotePath1, RemotePath2, RemotePath3, RemotePath4
Dim RemotePath5, RemotePath6
Dim objNetwork, objUser, CurrentUser
Dim strGroup
Dim strList
Dim objSysinfo

Const Technicians_Group = "cn=technicians"
Const AdminStaff_Group = "cn=admin staff"

Set objNetwork = CreateObject("WScript.Network")
Set objUser = CreateObject("ADSystemInfo")
Set CurrentUser = GetObject("LDAP://" & objUser.UserName)
strGroup = LCase(Join(CurrentUser.MemberOf))
strList = objSysinfo.Computername


DriveLetter1 = "G:"
DriveLetter2 = "H:"
RemotePath1 = "\\admin-server1\dida"
RemotePath2 = "\\net-server1\coursework"
objNetwork.MapNetworkDrive DriveLetter1, RemotePath1
objNetwork.MapNetworkDrive DriveLetter2, RemotePath2

'-------- Map Drives by Group Membership --------

'*******Technicians_Group*******
If InStr(strGroup, Technicians_Group ) Then
DriveLetter3 = "M:"
DriveLetter4 = "N:"
DriveLetter5 = "S:"
DriveLetter6 = "Z:"
RemotePath3 = "\\NET-SERVER3\miscfiles$"
RemotePath4 = "\\admin-server2\common"
RemotePath5 = "\\NET-SERVER2\Software"
RemotePath6 = "\\net-server3\administration$"
objNetwork.MapNetworkDrive DriveLetter3, RemotePath3
objNetwork.MapNetworkDrive DriveLetter4, RemotePath4
objNetwork.MapNetworkDrive DriveLetter5, RemotePath5
objNetwork.MapNetworkDrive DriveLetter6, RemotePath6
End If

'*******AdminStaff_Group********
If InStr(strGroup, AdminStaff_Group ) Then
DriveLetter3 = "P:"
DriveLetter4 = "M:"
DriveLetter5 = "S:"
DriveLetter6 = "N:"
RemotePath3 = "\\admin-server2\fileroom"
RemotePath4 = "\\admin-server2\clerks"
RemotePath5 = "\\admin-server2\stnddocs"
RemotePath6 = "\\admin-server2\common"
objNetwork.MapNetworkDrive DriveLetter3, RemotePath3
objNetwork.MapNetworkDrive DriveLetter4, RemotePath4
objNetwork.MapNetworkDrive DriveLetter5, RemotePath5
objNetwork.MapNetworkDrive DriveLetter6, RemotePath6
End If

WScript.Quit

 
Reply With Quote
  #4  
Old 11-Aug-2006, 01:18 PM
SiFor's Avatar
SiFor SiFor is offline
Administrator
Posts: 5,100
 
Reputation
Points: 1027 SiFor has over 1000 pointsSiFor has over 1000 pointsSiFor has over 1000 pointsSiFor has over 1000 pointsSiFor has over 1000 pointsSiFor has over 1000 pointsSiFor has over 1000 pointsSiFor has over 1000 points
Power: 74
Awards
None
Profile
Join Date: 23 Jun 2003
Location: Chesterfield, Derbyshire
Certifications: A+, MCSA:M 2003 MCSE 2003
Rep Power: 74
SiFor has over 1000 pointsSiFor has over 1000 pointsSiFor has over 1000 pointsSiFor has over 1000 pointsSiFor has over 1000 pointsSiFor has over 1000 pointsSiFor has over 1000 pointsSiFor has over 1000 points
Well I carried on and have nearly completed my script and here is a copy, maybe we could do some scripting threads to explain the whole process and all put in ideas.

Code:
Option Explicit
on error resume next

Dim DriveLetter1, DriveLetter2, DriveLetter3, DriveLetter4
Dim DriveLetter5, DriveLetter6, DriveLetter7, DriveLetter8
Dim DriveLetter9
Dim RemotePath1, RemotePath2, RemotePath3, RemotePath4
Dim RemotePath5, RemotePath6, RemotePath7, RemotePath8
Dim RemotePath9
Dim objNetwork, objUser, CurrentUser
Dim strGroup
Dim strList
Dim objSysinfo
Dim objPrinter

Const Staff_Group = "cn=staff"
Const Support_Group = "cn=support staff"
Const Technicians_Group = "cn=technicians"
Const Pupils_Group = "cn=pupils group"
Const Behavmon_Group = "cn=behavmon users"
Const AdminStaff_Group = "cn=admin staff"
Const DSAS_Group = "cn=dsas users"
Const Facilty_Group = "cn=facility users"
Const FileRoomUsers_Group = "cn=file room users"
Const HeadsOfYear_Group = "cn=heads of year"
Const IntegrisExportUsers_Group = "cn=integris export users"

Set objNetwork = CreateObject("WScript.Network")
Set objPrinter = CreateObject("WScript.Network")
Set objSysinfo = CreateObject("ADSystemInfo")

Set objUser = CreateObject("ADSystemInfo")
Set CurrentUser = GetObject("LDAP://" & objUser.UserName)
strGroup = LCase(Join(CurrentUser.MemberOf))
strList = objSysinfo.Computername

'-------- Map Drives by Group Membership --------

'*******Technicians_Group*******
If InStr(strGroup, Technicians_Group ) Then
DriveLetter1 = "F:"
DriveLetter2 = "G:"
DriveLetter3 = "H:"
DriveLetter4 = "I:"
DriveLetter5 = "K:"
DriveLetter6 = "M:"
DriveLetter7 = "N:"
DriveLetter8 = "S:"
DriveLetter9 = "Z:"
RemotePath1 = "\\admin-server2\fileroom"
RemotePath2 = "\\admin-server2\clerks"
RemotePath3 = "\\admin-server1\finance"
RemotePath4 = "\\server1\bromcom"
RemotePath5 = "\\admin-server2\behavmon"
RemotePath6 = "\\NET-SERVER3\miscfiles$"
RemotePath7 = "\\admin-server2\common"
RemotePath8 = "\\admin-server2\stnddocs"
RemotePath9 = "\\net-server3\administration$"
objNetwork.MapNetworkDrive DriveLetter1, RemotePath1
objNetwork.MapNetworkDrive DriveLetter2, RemotePath2
objNetwork.MapNetworkDrive DriveLetter3, RemotePath3
objNetwork.MapNetworkDrive DriveLetter4, RemotePath4
objNetwork.MapNetworkDrive DriveLetter5, RemotePath5
objNetwork.MapNetworkDrive DriveLetter6, RemotePath6
objNetwork.MapNetworkDrive DriveLetter7, RemotePath7
objNetwork.MapNetworkDrive DriveLetter8, RemotePath8
objNetwork.MapNetworkDrive DriveLetter9, RemotePath9
End If

'*******AdminStaff_Group********
If InStr(strGroup, AdminStaff_Group ) Then
DriveLetter1 = "F:"
DriveLetter2 = "G:"
DriveLetter3 = "S:"
DriveLetter4 = "N:"
RemotePath1 = "\\admin-server2\fileroom"
RemotePath2 = "\\admin-server2\clerks"
RemotePath3 = "\\admin-server2\stnddocs"
RemotePath4 = "\\admin-server2\common"
objNetwork.MapNetworkDrive DriveLetter1, RemotePath1
objNetwork.MapNetworkDrive DriveLetter2, RemotePath2
objNetwork.MapNetworkDrive DriveLetter3, RemotePath3
objNetwork.MapNetworkDrive DriveLetter4, RemotePath4
End If

'*******Staff_Group*******
If InStr(strGroup, Staff_Group ) Then
DriveLetter1 = "M:"
DriveLetter2 = "N:"
DriveLetter3 = "G:"
RemotePath1 = "\\NET-SERVER3\miscfiles$"
RemotePath2 = "\\admin-server2\common"
RemotePath3 = "\\net-server1\global"
objNetwork.MapNetworkDrive DriveLetter1, RemotePath1
objNetwork.MapNetworkDrive DriveLetter2, RemotePath2
objNetwork.MapNetworkDrive DriveLetter3, RemotePath3
End If

'*******FileRoomUsers_Group*******
If InStr(strGroup, FileRoomUsers_Group ) Then
DriveLetter1 = "F:"
RemotePath1 = "\\admin-server2\fileroom"
objNetwork.MapNetworkDrive DriveLetter1, RemotePath1
End If

'*******Behavmon_Group*******
If InStr(strGroup, Behavmon_Group ) Then
DriveLetter1 = "K:"
RemotePath1 = "\\admin-server2\behavmon"
objNetwork.MapNetworkDrive DriveLetter1, RemotePath1
End If

'*******HeadsOfYear_Group*******
If InStr(strGroup, HeadsOfYear_Group ) Then
DriveLetter1 = "K:"
RemotePath1 = "\\admin-server2\behavmon"
objNetwork.MapNetworkDrive DriveLetter1, RemotePath1
End If

'*******DSAS_Group*******
If InStr(strGroup, DSAS_Group ) Then
DriveLetter1 = "H:"
RemotePath1 = "\\admin-server1\finance"
objNetwork.MapNetworkDrive DriveLetter1, RemotePath1
End If

'*******IntegrisExportUsers_Group*******
If InStr(strGroup, IntegrisExportUsers_Group ) Then
DriveLetter1 = "I:"
RemotePath1 = "\\server1\bromcom"
objNetwork.MapNetworkDrive DriveLetter1, RemotePath1
End If

'*******Pupils_Group*******
If InStr(strGroup, Pupils_Group ) Then
DriveLetter1 = "M:"
DriveLetter2 = "G:"
RemotePath1 = "\\NET-SERVER3\miscfiles$"
RemotePath2 = "\\net-server1\global"
objNetwork.MapNetworkDrive DriveLetter1, RemotePath1
objNetwork.MapNetworkDrive DriveLetter2, RemotePath2
End If

'-------- Assign Printer by Group Membership --------
If InStr(strGroup, Technicians_Group ) Then
objPrinter.AddWindowsPrinterConnection "\\admin-server2\c3d-hp2230"
objPrinter.AddWindowsPrinterConnection "\\admin-server2\c3c-hp2200"
objPrinter.AddWindowsPrinterConnection "\\admin-server2\T5A-HP1100"
objPrinter.AddWindowsPrinterConnection "\\admin-server2\library-hp1100"
objPrinter.AddWindowsPrinterConnection "\\admin-server2\C2G-HP2230"
End If

'-------- Assign Printer by OU's --------

If instr(strList, "OU=C3D") then
objPrinter.AddWindowsPrinterConnection "\\admin-server2\c3d-hp2230"
objPrinter.SetDefaultPrinter "\\admin-server2\c3d-hp2230"

ElseIf instr(strList, "OU=C3C") then
objPrinter.AddWindowsPrinterConnection "\\admin-server2\c3c-hp2200"
objPrinter.SetDefaultPrinter "\\admin-server2\c3c-hp2200"

ElseIf instr(strList, "OU=T5A") then
objPrinter.AddWindowsPrinterConnection "\\admin-server2\T5A-HP1100"
objPrinter.SetDefaultPrinter "\\admin-server2\T5A-HP1100"

ElseIf instr(strList, "OU=C2G") then
objPrinter.AddWindowsPrinterConnection "\\admin-server2\C2G-HP2230"
objPrinter.SetDefaultPrinter "\\admin-server2\C2G-HP2230"

ElseIf instr(strList, "OU=Library") then
objPrinter.AddWindowsPrinterConnection "\\admin-server2\library-hp1100"
objPrinter.SetDefaultPrinter "\\admin-server2\library-hp1100"

End If

WScript.Quit

 
Reply With Quote
  #5  
Old 11-Aug-2006, 02:09 PM
Boycie's Avatar
Boycie Boycie is offline
Senior Beer Tester
Posts: 6,241
 
Reputation
Points: 1794 Boycie has over 1500 pointsBoycie has over 1500 pointsBoycie has over 1500 pointsBoycie has over 1500 pointsBoycie has over 1500 pointsBoycie has over 1500 pointsBoycie has over 1500 pointsBoycie has over 1500 pointsBoycie has over 1500 pointsBoycie has over 1500 pointsBoycie has over 1500 points
Power: 89
Awards
None
Profile
Join Date: 23 Feb 2005
Location: Cardiff
Certifications: MCSA 2003, MCDST, A+, N+, CTT+, MCT
Rep Power: 89
Boycie has over 1500 pointsBoycie has over 1500 pointsBoycie has over 1500 pointsBoycie has over 1500 pointsBoycie has over 1500 pointsBoycie has over 1500 pointsBoycie has over 1500 pointsBoycie has over 1500 pointsBoycie has over 1500 pointsBoycie has over 1500 pointsBoycie has over 1500 points
Quote:
Originally Posted by SiFor
maybe we could do some scripting threads to explain the whole process and all put in ideas.
yes please.

 
Reply With Quote
  #6  
Old 11-Aug-2006, 02:34 PM
jackd's Avatar
jackd jackd is offline
Longterm Member
Posts: 555
 
Reputation
Points: 236 jackd has over 100 pointsjackd has over 100 pointsjackd has over 100 points
Power: 15
Awards
None
Profile
Join Date: 14 Mar 2006
Location: Durham , UK
Age: 15
Rep Power: 15
jackd has over 100 pointsjackd has over 100 pointsjackd has over 100 points
Yer Cool!

 
Reply With Quote
  #7  
Old 11-Aug-2006, 02:38 PM
ffreeloader's Avatar
ffreeloader ffreeloader is offline
Lifetime Member
Posts: 3,663
 
Reputation
Points: 3099 ffreeloader has over 3000 pointsffreeloader has over 3000 pointsffreeloader has over 3000 pointsffreeloader has over 3000 pointsffreeloader has over 3000 pointsffreeloader has over 3000 pointsffreeloader has over 3000 pointsffreeloader has over 3000 pointsffreeloader has over 3000 pointsffreeloader has over 3000 pointsffreeloader has over 3000 points
Power: 75
Awards
None
Profile
Join Date: 26 Jul 2005
Location: USA
Age: 56
Certifications: MCSE, MCDBA, CCNA, A+
WIP: LPIC 1
Rep Power: 75
ffreeloader has over 3000 pointsffreeloader has over 3000 pointsffreeloader has over 3000 pointsffreeloader has over 3000 pointsffreeloader has over 3000 pointsffreeloader has over 3000 pointsffreeloader has over 3000 pointsffreeloader has over 3000 pointsffreeloader has over 3000 pointsffreeloader has over 3000 pointsffreeloader has over 3000 points
That's a pretty handy script, Sifor. I have a quick question though. Do you not comment your scripts or, do you just comment your complex scripts?

I ask because I've found that commenting my bash scripts makes it a lot easier to not only read them but to remember exactly why I did what I did a few months later.



Behold, the turtle. He makes progress only when he sticks his neck out.

James Bryant Conant
 
Reply With Quote
  #8  
Old 12-Aug-2006, 11:15 AM
Sparky's Avatar
Sparky Sparky is offline
I`ll have a pint...
Posts: 7,964
 
Reputation
Points: 7314 Sparky has over 4000 pointsSparky has over 4000 pointsSparky has over 4000 pointsSparky has over 4000 pointsSparky has over 4000 pointsSparky has over 4000 pointsSparky has over 4000 pointsSparky has over 4000 pointsSparky has over 4000 pointsSparky has over 4000 pointsSparky has over 4000 points
Power: 160
Awards
None
Profile
Join Date: 15 Dec 2005
Location: Scotland
Certifications: MSc MCSE MCSA:M MCITP:EA MCTS(x4) N+ A+
WIP: Feels like everything : )
Rep Power: 160
Sparky has over 4000 pointsSparky has over 4000 pointsSparky has over 4000 pointsSparky has over 4000 pointsSparky has over 4000 pointsSparky has over 4000 pointsSparky has over 4000 pointsSparky has over 4000 pointsSparky has over 4000 pointsSparky has over 4000 pointsSparky has over 4000 points
Impressive script, looks like it will save time messing around with batch files.

Have you tested it? I tried to map drives and add printers with vbs but when the user logged on for the second it would throw a ‘drive letter in use’ error but I think the ‘On error’ part of the code you have added might get you around that problem.

 
Reply With Quote
  #9  
Old 16-Aug-2006, 12:13 PM
SiFor's Avatar
SiFor SiFor is offline
Administrator
Posts: 5,100
 
Reputation
Points: 1027 SiFor has over 1000 pointsSiFor has over 1000 pointsSiFor has over 1000 pointsSiFor has over 1000 pointsSiFor has over 1000 pointsSiFor has over 1000 pointsSiFor has over 1000 pointsSiFor has over 1000 points
Power: 74
Awards
None
Profile
Join Date: 23 Jun 2003
Location: Chesterfield, Derbyshire
Certifications: A+, MCSA:M 2003 MCSE 2003
Rep Power: 74
SiFor has over 1000 pointsSiFor has over 1000 pointsSiFor has over 1000 pointsSiFor has over 1000 pointsSiFor has over 1000 pointsSiFor has over 1000 pointsSiFor has over 1000 pointsSiFor has over 1000 points
After some testing and fine tuning my logon script is about complete, heres a copy:

NOTE: The previous scripts will not work with users that are members of one usergroup (not including domain users), there is a workaround in this script that will rectify that.
Code:
'--------Mapping drives and printer script --------
'--------by SiFor www.certforums.co.uk --------
Option Explicit
on error resume next

'--------Declares variables and allocates storage space with Dim------
Dim DriveLetter1, DriveLetter2, DriveLetter3, DriveLetter4
Dim DriveLetter5, DriveLetter6, DriveLetter7, DriveLetter8
Dim DriveLetter9, DriveLetter10
Dim RemotePath1, RemotePath2, RemotePath3, RemotePath4
Dim RemotePath5, RemotePath6, RemotePath7, RemotePath8
Dim RemotePath9, RemotePath10
Dim objNetwork, objUser, CurrentUser
Dim strGroup
Dim strList
Dim objSysinfo
Dim objPrinter

'-------- Initialise Groups with Const (cn names must be lowercase)  --------
Const Technicians_Group = "cn=technicians"
Const AdminStaff_Group = "cn=admin staff"
Const Teachers_Group = "cn=teachers"
Const Support_Group = "cn=support staff"
Const StudentTeachers_Group = "cn=student teachers"
Const Pupils_Group = "cn=pupils group"
Const FileRoomUsers_Group = "cn=file room users"
Const Behavmon_Group = "cn=behavmon users"
Const HeadsOfYear_Group = "cn=heads of year"
Const DSAS_Group = "cn=dsas users"
Const IntegrisExportUsers_Group = "cn=integris export users"

'-------- Create objects and extract values --------
Set objNetwork = CreateObject("WScript.Network")
Set objUser = CreateObject("ADSystemInfo")
Set CurrentUser = GetObject("LDAP://" & objUser.UserName)
Set objPrinter = CreateObject("WScript.Network")
Set objSysinfo = CreateObject("ADSystemInfo")
strList = objSysinfo.Computername

'-------- workaround for Join not supporting single group membership --------
If IsArray(CurrentUser.MemberOf) Then
strGroup = LCase(Join(CurrentUser.MemberOf))
Else
strGroup = lcase(CurrentUser.MemberOf) 
End If



'-------- Contruct drive mapping --------
DriveLetter1 = "F:"
DriveLetter2 = "G:"
DriveLetter3 = "H:"
DriveLetter4 = "I:"
DriveLetter5 = "K:"
DriveLetter6 = "L:"
DriveLetter7 = "M:"
DriveLetter8 = "N:"
DriveLetter9 = "S:"
DriveLetter10 = "Z:"
RemotePath1 = "\\admin-server2\fileroom"
RemotePath2 = "\\net-server1\global"
RemotePath3 = "\\admin-server1\finance"
RemotePath4 = "\\server1\bromcom"
RemotePath5 = "\\admin-server2\behavmon"
RemotePath6 = "\\admin-server2\clerks"
RemotePath7 = "\\NET-SERVER3\miscfiles$"
RemotePath8 = "\\admin-server2\common"
RemotePath9 = "\\admin-server2\stnddocs"
RemotePath10 = "\\net-server3\administration$"

'--------START Map Drives by Group Membership --------
'*******Technicians_Group*******
If InStr(strGroup, Technicians_Group ) Then
objNetwork.MapNetworkDrive DriveLetter1, RemotePath1
objNetwork.MapNetworkDrive DriveLetter2, RemotePath2
objNetwork.MapNetworkDrive DriveLetter3, RemotePath3
objNetwork.MapNetworkDrive DriveLetter4, RemotePath4
objNetwork.MapNetworkDrive DriveLetter5, RemotePath5
objNetwork.MapNetworkDrive DriveLetter6, RemotePath6
objNetwork.MapNetworkDrive DriveLetter7, RemotePath7
objNetwork.MapNetworkDrive DriveLetter8, RemotePath8
objNetwork.MapNetworkDrive DriveLetter9, RemotePath9
objNetwork.MapNetworkDrive DriveLetter10, RemotePath10
End If

'*******AdminStaff_Group********
If InStr(strGroup, AdminStaff_Group ) Then
objNetwork.MapNetworkDrive DriveLetter1, RemotePath1
objNetwork.MapNetworkDrive DriveLetter6, RemotePath6
objNetwork.MapNetworkDrive DriveLetter8, RemotePath8
objNetwork.MapNetworkDrive DriveLetter9, RemotePath9
End If

'*******Teachers_Group*******
If InStr(strGroup, Teachers_Group ) Then
objNetwork.MapNetworkDrive DriveLetter2, RemotePath2
objNetwork.MapNetworkDrive DriveLetter7, RemotePath7
objNetwork.MapNetworkDrive DriveLetter8, RemotePath8
End If

'*******Support_Group*******
If InStr(strGroup, Support_Group ) Then
objNetwork.MapNetworkDrive DriveLetter2, RemotePath2
objNetwork.MapNetworkDrive DriveLetter7, RemotePath7
objNetwork.MapNetworkDrive DriveLetter8, RemotePath8
End If

'*******StudentTeachers_Group*******
If InStr(strGroup, StudentTeachers_Group ) Then
objNetwork.MapNetworkDrive DriveLetter2, RemotePath2
objNetwork.MapNetworkDrive DriveLetter7, RemotePath7
objNetwork.MapNetworkDrive DriveLetter8, RemotePath8
End If

'*******Pupils_Group*******
If InStr(strGroup, Pupils_Group ) Then
objNetwork.MapNetworkDrive DriveLetter7, RemotePath7
End If

'*******FileRoomUsers_Group*******
If InStr(strGroup, FileRoomUsers_Group ) Then
objNetwork.MapNetworkDrive DriveLetter1, RemotePath1
End If

'*******Behavmon_Group*******
If InStr(strGroup, Behavmon_Group ) Then
objNetwork.MapNetworkDrive DriveLetter5, RemotePath5
End If

'*******HeadsOfYear_Group*******
If InStr(strGroup, HeadsOfYear_Group ) Then
objNetwork.MapNetworkDrive DriveLetter5, RemotePath5
End If

'*******DSAS_Group*******
If InStr(strGroup, DSAS_Group ) Then
objNetwork.MapNetworkDrive DriveLetter3, RemotePath3
End If

'*******IntegrisExportUsers_Group*******
If InStr(strGroup, IntegrisExportUsers_Group ) Then
objNetwork.MapNetworkDrive DriveLetter4, RemotePath4
End If

'--------END Map Drives by Group Membership --------


'-------- Assign Printer by Group Membership --------
If InStr(strGroup, Technicians_Group ) Then
objPrinter.AddWindowsPrinterConnection "\\admin-server2\c3d-hp2230"
objPrinter.AddWindowsPrinterConnection "\\admin-server2\c3c-hp2200"
objPrinter.AddWindowsPrinterConnection "\\admin-server2\T5A-HP1100"
objPrinter.AddWindowsPrinterConnection "\\admin-server2\library-hp1100"
objPrinter.AddWindowsPrinterConnection "\\admin-server2\C2G-HP2230"
End If

'-------- Assign Printer by OU's --------

If instr(strList, "OU=C3D") then
objPrinter.AddWindowsPrinterConnection "\\admin-server2\c3d-hp2230"
objPrinter.SetDefaultPrinter "\\admin-server2\c3d-hp2230"

ElseIf instr(strList, "OU=C3C") then
objPrinter.AddWindowsPrinterConnection "\\admin-server2\c3c-hp2200"
objPrinter.SetDefaultPrinter "\\admin-server2\c3c-hp2200"

ElseIf instr(strList, "OU=T5A") then
objPrinter.AddWindowsPrinterConnection "\\admin-server2\T5A-HP1100"
objPrinter.SetDefaultPrinter "\\admin-server2\T5A-HP1100"

ElseIf instr(strList, "OU=C2G") then
objPrinter.AddWindowsPrinterConnection "\\admin-server2\C2G-HP2230"
objPrinter.SetDefaultPrinter "\\admin-server2\C2G-HP2230"

ElseIf instr(strList, "OU=Library") then
objPrinter.AddWindowsPrinterConnection "\\admin-server2\library-hp1100"
objPrinter.SetDefaultPrinter "\\admin-server2\library-hp1100"


End If

WScript.Quit

 
Reply With Quote
  #10  
Old 17-Aug-2006, 08:25 AM
SiFor's Avatar
SiFor SiFor is offline
Administrator
Posts: 5,100
 
Reputation
Points: 1027 SiFor has over 1000 pointsSiFor has over 1000 pointsSiFor has over 1000 pointsSiFor has over 1000 pointsSiFor has over 1000 pointsSiFor has over 1000 pointsSiFor has over 1000 pointsSiFor has over 1000 points
Power: 74
Awards
None
Profile
Join Date: 23 Jun 2003
Location: Chesterfield, Derbyshire
Certifications: A+, MCSA:M 2003 MCSE 2003
Rep Power: 74
SiFor has over 1000 pointsSiFor has over 1000 pointsSiFor has over 1000 pointsSiFor has over 1000 pointsSiFor has over 1000 pointsSiFor has over 1000 pointsSiFor has over 1000 pointsSiFor has over 1000 points
Has anyone got any use from this script BTW, I'll try and do a walkthrough at some point but my time is limited so it may take a while.

Si

 
Reply With Quote
  #11  
Old 26-Sep-2008, 04:04 PM
Luddym's Avatar
Luddym Luddym is offline
Longterm Member
Posts: 784
 
Reputation
Points: 880 Luddym has over 500 pointsLuddym has over 500 pointsLuddym has over 500 pointsLuddym has over 500 pointsLuddym has over 500 pointsLuddym has over 500 pointsLuddym has over 500 points
Power: 24
Awards
None
Profile
Join Date: 13 Sep 2005
Location: London UK
Age: 30
Certifications: VCP,A+, N+, MCSA, MCSE
WIP: Christmas Drunkard
Rep Power: 24
Luddym has over 500 pointsLuddym has over 500 pointsLuddym has over 500 pointsLuddym has over 500 pointsLuddym has over 500 pointsLuddym has over 500 pointsLuddym has over 500 points
Sorry for adding to a thread that is quite old, but.... I'd just like to thank you SiFor for sharing the script. I've been looking about today for solutions to my problems, and this looks like just the ticket.

I'm actually looking forward to work next week so I can edit and implement this, so we can finally get rid of all those rubbish logon scripts we have at present.

Thanks again, and rep quite rightly given.


To Do List of 2010:

Windows Server 2008 upgrades.

 
Reply With Quote
Reply

Go Back   CertForums > Computing Support Forums > Programming & Scripting

Bookmarks

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +1. The time now is 02:12 AM.
Powered by vBulletin® Version 3.8.4
Copyright ©2000 - 2010, Jelsoft Enterprises Ltd.
CertForums.co.uk (C) copyright 2003-2009 All Rights Reserved. Content published on CertForums.co.uk requires permission for reprint.
Lunarpages.com Web Hosting