Map to Full User Name

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • PSTech
    New Member
    • Feb 2008
    • 2

    Map to Full User Name

    I currently use in my script:

    Dim WshNetwork
    Set WshNetwork = WScript.CreateO bject("WScript. Network")
    'on error resume next
    wshNetwork.MapN etworkDrive "U:" , "\\Server\User$ \" & wshNetwork.User Name

    This maps a drive to the user login name

    I would like to map to a user full name
  • Killer42
    Recognized Expert Expert
    • Oct 2006
    • 8429

    #2
    Originally posted by PSTech
    ...This maps a drive to the user login name

    I would like to map to a user full name
    I don't think the network has a full user name recorded anywhere.

    Comment

    • PSTech
      New Member
      • Feb 2008
      • 2

      #3
      Yes I know, pretty sure WshNetwork has only 3 object references.

      I was looking for a enviroment set I could insert. Like what I found to list all users on a domain. The script below will list all users including Full Name on domain accounts as well. If I could pull current login and set a variable I could use that.

      Sorry, I am fairly new to scripting.


      ComputerName = localhost

      winmgmt1 = "winmgmts:{impe rsonationLevel= impersonate}!//"& ComputerName &""

      Set UserSet = GetObject( winmgmt1 ).InstancesOf ("Win32_UserAcc ount")

      for each User in UserSet
      WScript.Echo "============== =============== =============== ===" & vbCRLF & _
      "Informatio n for " & User.Name & vbCRLF & _
      "The full username for the specified computer is: " & User.FullName & vbCRLF & _
      "Account Locked? " & User.Lockout & vbCRLF & _
      "Password can be changed?: " & User.PasswordCh angeable & vbCRLF & _
      "Password is expirable: " & User.PasswordEx pires & vbCRLF & _
      "============== =============== =============== ==="
      Next

      Comment

      Working...