Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium


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
Medium Priority
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:Michael Spellman
  • 2
  • 2
LVL 40

Expert Comment

ID: 38326098
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.

Accepted Solution

WebDevEM earned 2000 total points
ID: 38326124
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 40

Expert Comment

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

Expert Comment

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

Author Closing Comment

by:Michael Spellman
ID: 38326441
I like it!  It is straight forward and simple to use.
Thanks.  I will give it a shot.

Featured Post

Simplify Active Directory Administration

Administration of Active Directory does not have to be hard.  Too often what should be a simple task is made more difficult than it needs to be.The solution?  Hyena from SystemTools Software.  With ease-of-use as well as powerful importing and bulk updating capabilities.

Question has a verified solution.

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

Group policies can be applied selectively to specific devices with the help of groups. Utilising this, it is possible to phase-in group policies, over a period of time, by randomly adding non-members user or computers at a set interval, to a group f…
It’s time for spooky stories and consuming way too much sugar, including the many treats we’ve whipped for you in the world of tech. Check it out!
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 …
There are cases when e.g. an IT administrator wants to have full access and view into selected mailboxes on Exchange server, directly from his own email account in Outlook or Outlook Web Access. This proves useful when for example administrator want…

571 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