Photo Gallery Member List Search Calendars FAQ Ticket List Log Out


Need to display CN Name not username

 
Logged in as: Guest
arrSession:exec spGetSession 2,2,62134
 Active Users: There are 0 members and 0 guests.
 Users viewing this topic: none
 

 

 
  
  Printable Version
All Forums >> [Scripting] >> WSH & Client Side VBScript >> Need to display CN Name not username
  Do you like VisualBasicScript.com? Link to us and help spread the word about our forum. Thanks!
Page: [1]
Login
Message << Older Topic   Newer Topic >>
 Need to display CN Name not username - 7/2/2008 10:27:12 PM   
  robhart84

 

Posts: 4
Score: 0
Joined: 6/25/2008
Status: offline
Hi all,

i have created a script for updating the Computer Description on a local macine but so far i can only get it do show the users username. i would be much better if i could get it to show the full name.

can any one help with this please. ive been scouring the net for about 3 hours now and am no closer to a resoloution.

here is the script that i have

Thanks in Advance


Const HKEY_LOCAL_MACHINE = &H80000002
strComputer = "."
Set Shell = CreateObject("WScript.Shell")
UserName = Shell.ExpandEnvironmentStrings("%UserName%")
Set objRegistry = GetObject _
   ("winmgmts:\\" & strComputer & "\root\default:StdRegProv")
strKeyPath = "System\CurrentControlSet\Services\lanmanserver\parameters"
strValueName = "srvcomment"
strDescription = UserName
objRegistry.SetStringValue HKEY_LOCAL_MACHINE, strKeyPath, strValueName, strDescription
 
 
Post #: 1
 
 RE: Need to display CN Name not username - 7/2/2008 11:28:50 PM   
  Rischip


Posts: 468
Score: 2
Joined: 3/26/2007
Status: offline
This will get you the name


      

_____________________________

Rischip
Author of - The Grim Linker

(in reply to robhart84)
 
 
Post #: 2
 
 RE: Need to display CN Name not username - 7/3/2008 12:18:12 AM   
  robhart84

 

Posts: 4
Score: 0
Joined: 6/25/2008
Status: offline
thanks, that portion of the script works great.

how do i take the result and use it for the rest of my script ie using the result for the computers description

Thanks for your help so far

(in reply to Rischip)
 
 
Post #: 3
 
 RE: Need to display CN Name not username - 7/3/2008 12:26:30 AM   
  ebgreen


Posts: 4613
Score: 31
Joined: 7/12/2005
Status: offline
If I understand, then just do this:

strName = objAccount.FullName

then use strName in your script wherever you want.

_____________________________

"... when you are good and crazy, oooh, oooh, oooh, the sky is the limit!" - The Tick
Goog places to start:http://www.visualbasicscript.com/m_24727/tm.htm
http://www.visualbasicscript.com/m_47117/tm.htm

(in reply to robhart84)
 
 
Post #: 4
 
 
 
  

If you found our site useful please link to us <a href="http://www.visualbasicscript.com">VisualBasicScript.com</a>.
All Forums >> [Scripting] >> WSH & Client Side VBScript >> Need to display CN Name not username Page: [1]
Jump to:





New Messages No New Messages
Hot Topic w/ New Messages Hot Topic w/o New Messages
Locked w/ New Messages Locked w/o New Messages
 Post New Thread
 Reply to Message
 Post New Poll
 Submit Vote
 Delete My Own Post
 Delete My Own Thread
 Rate Posts