creating a login script with visual studio 08?
- I new to programming, and I have been playing with Visual Basic.
I would like to create a logon script to run in my network. But I am running into a couple of walls.
first: Is it possible to map network drives?
second: how can I use groups?
third: I usually use my scripts to send files down to the pcs. Is there a copy command I can use?
fourth: Is there a sleep command I can use?
Thanks,
Armando
Armando Diaz
Answers
- Richard Thanks, I got it.
anonymousaeiou- you have too much time on your hands- get a life.
Armando Diaz- Marked As Answer byArmandoDiaz Friday, November 06, 2009 1:47 PM
All Replies
- You'll probably get on better with VBScript. Start here
http://www.computerperformance.co.uk/Logon/logon_scripts.htm
(And the answers to your questions are "Yes", "you can extract the members, or check to see if a user is a member, amongst other things","Yes" and "yes") - Thanks, I almost got it. But I'm having one small issue. We have a server with user's full name as directories. Is there any way to map this? Here's my sample:
objNetwork.MapNetworkDrive "y:", "\\server\dir\" & FullName
Armando Diaz - If you can help, also looking to change the color and size of my text:
objExplorer.Document.Body.InnerHTML = "Warning you are entering a Private Network! Only authorized users are permitted!"
Thanks,
Armando Diaz - Not worth my breathe,
Nick, thanks for your help. I got the fonts working, but still working on the FullName.
Armando Diaz You can use the ADSystemInfo object (as long as all clients have Windows 2000 or above) to retrieve the Distinguished Name (DN) of the current user. Then you can bind to the user object in AD and retrieve any attribute values desired. By FullName, I think you mean the value of the displayName attribute. This is called "Display Name" on the "General" tab of ADUC, but is called FullName in NT (and the WinNT provider). However, you could also mean the value of the cn attribute (the Common Name of the user, which I think is referred to as the full name in the ADUC GUI when you create users). In either case:
========
Dim objSysInfo, strUserDN, objUser
Dim strName, strCN, objNetwork
' Retrieve DN of current user.
Set objSysInfo = CreateObject("ADSystemInfo")
strUserDN = objSysInfo.UserName
' Bind to current user object in AD.
Set objUser = GetObject("LDAP://" & strUserDN)
' Retrieve displayName of user.
strName = objUser.displayName
' Retrieve Common Name of user.
strCN objUser.cn
' Map a drive.
Set objNetwork = CreateObject("Wscript.Network")
objNetwork.MapNetworkDrive "y:", "\\server\dir\" & strName
========
Whether you use strName (the value of displayName) or strCN (the Common Name) is up to you. I note that all users have a value for cn, but displayName is not a mandatory attribute, so there could be no value assigned.
Richard Mueller
MVP ADSI- Thanks Richard, I'll try that in the morning.
This mapping is for a select few, which I already have working with Kixtart, so it shouldn't be a big worry.
Thanks again,
Armando Diaz - Richard Thanks, I got it.
anonymousaeiou- you have too much time on your hands- get a life.
Armando Diaz- Marked As Answer byArmandoDiaz Friday, November 06, 2009 1:47 PM

