Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

Login Scripts in AD 2000

Posted on 2009-07-05
6
Medium Priority
?
210 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 150 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

Has Powershell sent you back into the Stone Age?

If managing Active Directory using Windows Powershell® is making you feel like you stepped back in time, you are not alone.  For nearly 20 years, AD admins around the world have used one tool for day-to-day AD management: Hyena. Discover why.

Question has a verified solution.

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

Let's recap what we learned from yesterday's Skyport Systems webinar.
Wouldn't it be nice if objects in Active Directory automatically moved into the correct Organizational Units? This is what AutoAD aims to do and as a plus, it automatically creates Sites, Subnets, and Organizational Units.
Microsoft Active Directory, the widely used IT infrastructure, is known for its high risk of credential theft. The best way to test your Active Directory’s vulnerabilities to pass-the-ticket, pass-the-hash, privilege escalation, and malware attacks …
Sometimes it takes a new vantage point, apart from our everyday security practices, to truly see our Active Directory (AD) vulnerabilities. We get used to implementing the same techniques and checking the same areas for a breach. This pattern can re…
Suggested Courses

885 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