User Information

I'm writting up some documentation right now to help users that have basic knowledge of windows to find out what type of account they are logged in as. Is there anyway through javascript or any other web based way of displaying this information to them?

Or is there a simple way the user can find out what type of account they have (and possibly other information)?
Who is Participating?
WallsyConnect With a Mentor Commented:
Here's a snippet out of our PC helpdesk web page. I'm not too good with this stuff, but hopefully it's enough to get you started...



Sub ShowTableUserEnvironment()
Dim strHTML
Dim objItem
Dim objSysInfo
Dim objGroup
Dim x

On Error Resume Next

      ' Generate the default table            
      strHTML = GenTablePref()
      strHTML = strHTML & GenHeader(gstrHeadLine)
      Set objSysInfo= CreateObject("ADSystemInfo")      
      Set objItem= GetObject("LDAP://" & objSysInfo.UserName & "")
      strHTML = strHTML & GenLine( "Account Name" , objItem.Get("sAMAccountName"))
      strHTML = strHTML & GenLine( "Full Name" , objItem.FullName)
      strHTML = strHTML & GenLine( "LDAP User Name" , objSysInfo.UserName)
      If Len(objItem.HomeDirectory) Then strHTML = strHTML & GenLine( "Home Directory Path" , objItem.HomeDirectory)
      strHTML = strHTML & GenLine( "Home DirectoryDrive" , objItem.Get("homeDrive"))
      strHTML = strHTML & GenLine( "Profile" , objItem.Profile)
      strHTML = strHTML & GenLine( "Script Path" , objItem.Get("scriptPath"))
      strHTML = strHTML & GenLine( "Password Expires" , objItem.PasswordExpirationDate)
      If objItem.Groups Is Nothing then
            ' No Groups determined
            strHTML = strHTML & GenBldLine( "Group Membership" , "")
            For Each objGroup In objItem.Groups
                  x = x+1
                  strHTML = strHTML & GenLine( "Group " & x , Replace(objGroup.Name,"CN=",""))
      End if      
      strHTML = strHTML & GenTablePost()      
      objTable.innerHTML = strHTML
      Set objSysInfo = Nothing
      Set objItem = Nothing
      Set objGroup = Nothing
      Set objReg = Nothing
      Set gobjWMIService = Nothing  

End Sub

Function GenTablePref()

      GenTablePref = "<form id='Configuration'>"
      GenTablePref = GenTablePref & "<table cellSpacing='0' cellPadding='5' border='0'class='styleTblHeader'>"
End Function

Function GenHeader(ByVal strName)

       GenHeader = "<tr><td colspan='2' nowrap class='styleTblHeadColumn' height='40'>" & strName & "</td></tr>"
End Function

Function GenLine(ByVal strDesciption, ByVal strValue)

       GenLine = "<tr>"
       GenLine = GenLine & "<td nowrap class='styleTblLabel' height='30'>" & GetLocStr(strDesciption) & "</td>"
      GenLine = GenLine & "<td nowrap class='styleTblValue'>" & strValue & "&nbsp;</td>"
      GenLine = GenLine & "</tr>"
End Function

Function GenBldLine(ByVal strDesciption, ByVal strValue)

       GenBldLine = "<tr>"
       GenBldLine = GenBldLine & "<td nowrap class='styleTblBldLabel' height='30'>" & GetLocStr(strDesciption) & "</td>"
      GenBldLine = GenBldLine & "<td nowrap class='styleTblBldValue'>" & strValue & "&nbsp;</td>"
      GenBldLine = GenBldLine & "</tr>"
End Function

Function GenTablePost()

      GenTablePost = "</table>"
      GenTablePost = GenTablePost & "</form>"
      If bShowButton Then
            GenTablePost = GenTablePost & "<input id='cmdOK' type='button' value='  Close  ' onClick='CmdCloseWindow()'><br>"
      End If
      GenTablePost = GenTablePost & "<br><span class=""styleDocFooter"" id=""styleDocFooter"">(c) 2004 DaimlerChrysler AG</span>"
End Function

David LeeCommented:
Hi Shroder,
> what type of account they are logged in as

I don't understand what you mean.  Are you talking about a local account versus a domain account, or ... what?

ShroderAuthor Commented:
Sorry for being so general. I'm talking about local permissions.
Hire Technology Freelancers with Gigs

Work with freelancers specializing in everything from database administration to programming, who have proven themselves as experts in their field. Hire the best, collaborate easily, pay securely, and get projects done right.

David LeeCommented:
> local permissions
You mean local NTFS permissions, or all the rights the person has on the local machine, like the ability to log on locally and so forth?

Open a Command Prompt windows (CMD.EXE) and type this:


To output the results to a file


This fix will have all the information about that user account.
ShroderAuthor Commented:
Sorry for my ignorance. Can I use that as vbscript?
David LeeCommented:

You can separate the HTML from the VBScript and use the VBScript portion.  Also, if you can be more specific about exactly what pieces of information you want, then it's possible that the experts might be able to supply you with a script that'll provide exectly, or at least more closely, what you're looking for.
ShroderAuthor Commented:
Actually if I can get part of your snippet to work I can figure out the rest.

I'm getting the following error:
"No mapping between account names and security IDs was done"
using the following code:

Dim objSysinfo
Dim objItem
Set objSysinfo = CreateObject("ADSystemInfo")
MsgBox objSysInfo.UserName
More information on the ADSystemInfo object is at:

As I mentioned earlier, I'm not actually terribly good at this... I've just copied and pasted! As fas as I know it will only work on domain members, but someone else will probably be able to help you much more than that.


ShroderAuthor Commented:
No problem. :) Thanks for the help so far.
ShroderAuthor Commented:
Looks like that is suppose to work. It has problems with XP SP 2 though.
Thanks for the points - sorry I couldn't be more helpful though...


All Courses

From novice to tech pro — start learning today.