Solved

Login Scripts in AD 2000

Posted on 2009-07-05
6
208 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
[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
  • 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

Office 365 Training for Admins - 7 Day Trial

Learn how to provision tenants, synchronize on-premise Active Directory, implement Single Sign-On, customize Office deployment, and protect your organization with eDiscovery and DLP policies.  Only from Platform Scholar.

Question has a verified solution.

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

This article demonstrates probably the easiest way to configure domain-wide tier isolation within Active Directory. If you do not know tier isolation read https://technet.microsoft.com/en-us/windows-server-docs/security/securing-privileged-access/s…
After seeing many questions for JRNL_WRAP_ERROR for replication failure, I thought it would be useful to write this article.
This Micro Tutorial hows how you can integrate  Mac OSX to a Windows Active Directory Domain. Apple has made it easy to allow users to bind their macs to a windows domain with relative ease. The following video show how to bind OSX Mavericks to …
This video shows how to use Hyena, from SystemTools Software, to update 100 user accounts from an external text file. View in 1080p for best video quality.
Suggested Courses

623 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