Would it be possible to present a form to users at login that collects their login name (alias), computername, and has a field for entering their phone number & location code?

Posted on 2012-08-23
Last Modified: 2012-08-23
I want to update the phone numbers that are in the Active Directory.  Rather than wait for each user to put in a ticket to update the information, I was thinking that I could improve participation if I could present a form to the user when they login.
I could capture the username & computer name an dhave the user type in their phone number & their location code.  I would accummulate this information in a spreadsheet and use it to batch update the AD.  The user would hit a submit button on the form, which would post the information somewhere & stop the form from re-appearing at future logins.
Something along that line.  Just looking to update my AD info for 500 users.
Question by:mspellm
    LVL 39

    Expert Comment

    You can use vbscript:
    or powershell:
    It is not a problem to get other info and check record in some csv file with user info and don't ask twice.
    LVL 9

    Accepted Solution

    This vbs script could be added to their login batch file (assuming each of the computers supports running vbs... in my company they do) and it would prompt the user for their info then append it to a file on a network drive.  If their info already exists in that file, it won't ask them.  

    Another (more time-efficient) option for testing if they need to enter their info would be to create a file on their local drive and test if that file exists, but it does have a downside... If you need to reset the flag and have them get prompted again for any reason, you'd have to send another program to delete that file first.  My way, all you would need to do is delete their record from the CSV and they'll get asked again.

    Dim myPhone
    Dim myLocation
    Dim strComputerName
    Dim userName
    Dim objNetwork
    Dim alreadyDone
    Const ForAppending = 8
    Const ForReading = 1
    Const strFile = "h:\MasterLog.csv"
    Set objNetwork = CreateObject("WScript.Network")
    userName = objNetwork.UserName
    Set objFSO = CreateObject("Scripting.FileSystemObject")
    Set objFile = objFSO.OpenTextFile(strFile, ForReading)
    alreadyDone = 0
    Do Until objFile.AtEndOfStream
        strSearchString = objFile.ReadLine
    	If Left(strSearchString,Len(userName)) = userName Then
    		alreadyDone = 1
    	End If
    If alreadyDone = 0 Then
    	myPhone=InputBox("Enter your name",,"")
    	myLocation=InputBox("Enter your Location Code",,"")
    	Set wshShell = WScript.CreateObject( "WScript.Shell" )
    	strComputerName = wshShell.ExpandEnvironmentStrings( "%COMPUTERNAME%" )
    	set objFSO = CreateObject("Scripting.FileSystemObject")
    	set objFile = objFSO.OpenTextFile(strFile, ForAppending, True)
    	objFile.WriteLine(userName & "," & strComputerName & "," & myPhone & "," & myLocation )
    End If

    Open in new window

    LVL 39

    Expert Comment

    Very good, WebDevEM. Only one addition: add exit do after alreadyDone = 1.
    LVL 9

    Expert Comment

    Ah, good catch!  No sense in continuing to search once you find their name.

    Author Closing Comment

    I like it!  It is straight forward and simple to use.
    Thanks.  I will give it a shot.

    Featured Post

    Free Trending Threat Insights Every Day

    Enhance your security with threat intelligence from the web. Get trending threat insights on hackers, exploits, and suspicious IP addresses delivered to your inbox with our free Cyber Daily.

    Join & Write a Comment

    Companies that have implemented Microsoft’s Active Directory need to ensure that the Active Directory is configured and operating properly. If there are issues found and not resolved, it eventually leads the components to fail or stop working and fi…
    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 steps necessary to join and promote the first Windows Server 2012 domain controller into an Active Directory environment running on Windows Server 2008. Determine the location of the FSMO roles by lo…
    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…

    755 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

    21 Experts available now in Live!

    Get 1:1 Help Now