Photo Gallery Member List Search Calendars FAQ Ticket List Log Out


remote registry read (with alternate credentials)

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

 

 
  
  Printable Version
All Forums >> [Scripting] >> WSH & Client Side VBScript >> remote registry read (with alternate credentials)
  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 >>
 remote registry read (with alternate credentials) - 9/4/2006 12:04:09 PM   
  takeda kozo

 

Posts: 83
Score: 0
Joined: 11/9/2005
Status: offline
Hi all, I've used the microsoft script repository to locate the following example:

strComputer = "atl-fs-01"
strNamespace = "root\cimv2"
strUser = "kenmyer"
strPassword = "password"

Set objWbemLocator = CreateObject("WbemScripting.SWbemLocator")
Set objWMIService = objwbemLocator.ConnectServer _
(strComputer, strNamespace, strUser, strPassword)

Can anyone tell me how I could use this logic, above, to return registry key values on remote machines? (with alternate credentials) ?

Basically, we have two different admin accounts which have read access to remote registry. If AdminAccount_1 fails (access denied) then I would like to run the below section of script with alternate credentials (AdminAccount_2)


The section of my script currently looks like this:

'+++++++++++++++++++++++++++++++++++

strCurrentUser = "" 
Set oReg=GetObject("winmgmts:{impersonationLevel=impersonate}!\\" & Machine & "\root\default:StdRegProv") 
strKeyPath = "SOFTWARE\INTEL\LANDesk\VirusProtect6\CurrentVersion" 
strValueName = "LoggedOnUser" 
oReg.GetExpandedStringValue HKEY_LOCAL_MACHINE,strKeyPath, strValueName,strCurrentUser

Wscript.Echo strCurrentUser

'+++++++++++++++++++++++++++++++++++

< Message edited by takeda kozo -- 9/4/2006 12:05:43 PM >
 
 
Post #: 1
 
 RE: remote registry read (with alternate credentials) - 9/4/2006 1:26:15 PM   
  takeda kozo

 

Posts: 83
Score: 0
Joined: 11/9/2005
Status: offline
Found the answer. Maybe someone else can benefit too :P


+++++++++++++++++++++++++++++++++++++++++++

Const HKEY_LOCAL_MACHINE = &H80000002
strCurrentUser = ""
strKeyPath = "SOFTWARE\INTEL\LANDesk\VirusProtect6\CurrentVersion"
strValueName = "LoggedOnUser"
Set oLocator = CreateObject("WbemScripting.SWbemLocator")
Set oService = oLocator.ConnectServer(Machine, "Root\DEFAULT", strAdminUser, strAdminPass)
Set oRegistry = oService.Get("StdRegProv")
strKeyPath = "SOFTWARE\INTEL\LANDesk\VirusProtect6\CurrentVersion"
strValueName = "LoggedOnUser"
oRegistry.GetStringValue HKEY_LOCAL_MACHINE, strKeyPath, strValueName, strCurrentUser
WScript.Echo strCurrentUser

+++++++++++++++++++++++++++++++++++++++++++

(in reply to takeda kozo)
 
 
Post #: 2
 
 
 
  

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 >> remote registry read (with alternate credentials) 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