Photo Gallery Member List Search Calendars FAQ Ticket List Log Out


change value in registry

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

 

 
  
  Printable Version
All Forums >> [Scripting] >> WSH & Client Side VBScript >> change value in registry
  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 >>
 change value in registry - 6/8/2006 5:20:50 AM   
  NewBee

 

Posts: 32
Score: 0
Joined: 2/10/2006
Status: offline
i have the following script which works jus fine, however for the strDescription i like to use the current logged on user name.  can anyone show me how it would be done.

thanks,

Const HKEY_LOCAL_MACHINE = &H80000002
strComputer = "."
Set objRegistry = GetObject _
   ("winmgmts:\\" & strComputer & "\root\default:StdRegProv")
strKeyPath = "System\CurrentControlSet\Services\lanmanserver\parameters"
strValueName = "srvcomment"
strDescription = "Description changed programmatically"
objRegistry.SetStringValue HKEY_LOCAL_MACHINE, strKeyPath, strValueName, strDescription
 
 
Post #: 1
 
 RE: change value in registry - 6/8/2006 5:53:14 AM   
  mikeock


Posts: 124
Score: 1
Joined: 6/8/2006
Status: offline
What you want is something along these lines.


set NetObj = Wscript.CreateObject("wscript.Network")

strDescription = NetObj.UserName

Edit: had pc name not username in script

< Message edited by mikeock -- 6/8/2006 6:07:53 AM >

(in reply to NewBee)
 
 
Post #: 2
 
 RE: change value in registry - 6/8/2006 7:10:43 AM   
  NewBee

 

Posts: 32
Score: 0
Joined: 2/10/2006
Status: offline
mikeock
 
thanks for your assistance, it works just great for what i needed for.
 
cheers

(in reply to mikeock)
 
 
Post #: 3
 
 
 
  

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 >> change value in registry 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