Solved

Login Scripts in AD 2000

Posted on 2009-07-05
6
205 Views
Last Modified: 2013-12-05
I am in the middle of migrating data from stand alone servers to Blade/SAN systems, thus I would like to start using login scripts as opposed to using persistent drive mappings. I am new to writing scripts in AD, but I have done a little work in NetWare.

I need something simple like:

If user is a member of (group name) then
Net use T:\\sharename\
End  

I also need users to map to their Home folders by %username%

Do you have something short and simple?

0
Comment
Question by:edromer20
  • 3
  • 2
6 Comments
 
LVL 23

Expert Comment

by:debuggerau
ID: 24781765

;- login.vbs

ON ERROR RESUME NEXT

Dim WshNetwork
Set WshNetwork = WScript.CreateObject("WScript.Network")
Set NetObj = WScript.CreateObject("WScript.Network")
Set CheckDrive = NetObj.EnumNetworkDrives()

DriveLetter = "G:" 'DriveLetter must be a CAPITAL letter
RemotePath = "\\SVR\SHARE"
AlreadyConnected = False
For i = 0 To CheckDrive.Count - 1 Step 2
If CheckDrive.Item(i) = DriveLetter Then AlreadyConnected = True
Next
If AlreadyConnected = True then
NetObj.RemoveNetworkDrive DriveLetter
NetObj.MapNetworkDrive DriveLetter, RemotePath
'WshShell.PopUp "Drive " & DriveLetter & "Disconnected, then connected successfully."
Else
NetObj.MapNetworkDrive DriveLetter, RemotePath
'WshShell.PopUp "Drive " & DriveLetter & " connected successfully."
End if


if UserString = "specificAcct" then
WSHNetwork.MapNetworkDrive "M:", "\\SVR1\c$"
WSHNetwork.MapNetworkDrive "N:", "\\SVR1\C$"
WSHNetwork.MapNetworkDrive "O:", "\\SVR1\D$"
WSHNetwork.MapNetworkDrive "K:", "\\SVR1\e$"
WSHNetwork.MapNetworkDrive "P:", "\\SVR1\blabla"
WSHNetwork.MapNetworkDrive "Q:", "\\SVR1\e$"
End If


This should disconnect permanent mappings too..
Or just use the direct method as described for specificAcct.
remember, it is a .vbs file..
you could also map home drives from within AD itself under the profile tab for each user..

0
 

Author Comment

by:edromer20
ID: 24999797
What tool is use to create VBS and how are the scripts tested or implemented in an AD environment.
0
 
LVL 23

Accepted Solution

by:
debuggerau earned 50 total points
ID: 25001153
There are many script writers like Visual Studio, but notepad will suffice.

Usually, you would test them in an test environment, how you implement is dependent on the type of script, this one for instance is best used in a login script, either explicitly defined in AD, or from Group Policy.

Hope that helps
0
 

Author Closing Comment

by:edromer20
ID: 31599987
Home folders are addressed through user object? Can you recommend a beginner resource for writing scripts for AD 2003/2008?
0
 

Author Comment

by:edromer20
ID: 25005581
Can you recommend an easy to follow resource for writing and implementing scripts?
0

Featured Post

Best Practices: Disaster Recovery Testing

Besides backup, any IT division should have a disaster recovery plan. You will find a few tips below relating to the development of such a plan and to what issues one should pay special attention in the course of backup planning.

Question has a verified solution.

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

Restoring deleted objects in Active Directory has been a standard feature in Active Directory for many years, yet some admins may not know what is available.
This article outlines the process to identify and resolve account lockout in an Active Directory environment.
This tutorial will walk an individual through the process of configuring their Windows Server 2012 domain controller to synchronize its time with a trusted, external resource. Use Google, Bing, or other preferred search engine to locate trusted NTP …
This video shows how to use Hyena, from SystemTools Software, to bulk import 100 user accounts from an external text file. View in 1080p for best video quality.

856 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