Solved

Login Scripts in AD 2000

Posted on 2009-07-05
6
201 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
Comment Utility

;- 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
Comment Utility
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
Comment Utility
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
Comment Utility
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
Comment Utility
Can you recommend an easy to follow resource for writing and implementing scripts?
0

Featured Post

IT, Stop Being Called Into Every Meeting

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

Join & Write a Comment

Setting up a Microsoft WSUS update system is free relatively speaking if you have hard disk space and processor capacity.   However, WSUS can be a blessing and a curse. For example, there is nothing worse than approving updates and they just have…
On July 14th 2015, Windows Server 2003 will become End of Support, leaving hundreds of thousands of servers around the world that still run this 12 year old operating system vulnerable and potentially out of compliance in many organisations around t…
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…
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 …

743 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

Need Help in Real-Time?

Connect with top rated Experts

18 Experts available now in Live!

Get 1:1 Help Now