Script Center > Scripting Forums > The Official Scripting Guys Forum! > creating a login script with visual studio 08?
Ask a questionAsk a question
 

Answercreating a login script with visual studio 08?

  • Thursday, November 05, 2009 2:33 PMArmandoDiaz Users MedalsUsers MedalsUsers MedalsUsers MedalsUsers Medals
     
    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

All Replies

  • Thursday, November 05, 2009 4:45 PMnicktf Users MedalsUsers MedalsUsers MedalsUsers MedalsUsers Medals
     
    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")
  • Thursday, November 05, 2009 5:37 PMArmandoDiaz Users MedalsUsers MedalsUsers MedalsUsers MedalsUsers Medals
     
    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
  • Thursday, November 05, 2009 7:04 PMArmandoDiaz Users MedalsUsers MedalsUsers MedalsUsers MedalsUsers Medals
     
    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
  • Thursday, November 05, 2009 9:52 PMArmandoDiaz Users MedalsUsers MedalsUsers MedalsUsers MedalsUsers Medals
     
    Not worth my breathe,

    Nick, thanks for your help. I got the fonts working, but still working on the FullName.
    Armando Diaz
  • Thursday, November 05, 2009 11:44 PMRichard MuellerMVPUsers MedalsUsers MedalsUsers MedalsUsers MedalsUsers Medals
     

    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
  • Friday, November 06, 2009 12:02 AMArmandoDiaz Users MedalsUsers MedalsUsers MedalsUsers MedalsUsers Medals
     
    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
  • Friday, November 06, 2009 1:47 PMArmandoDiaz Users MedalsUsers MedalsUsers MedalsUsers MedalsUsers Medals
     Answer
    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
    •