Wrox Programmer Forums
|
Access VBA Discuss using VBA for Access programming.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Access VBA section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old October 25th, 2005, 08:57 AM
Registered User
 
Join Date: Oct 2005
Posts: 4
Thanks: 0
Thanked 0 Times in 0 Posts
Default remote registry

hi, i need a vba routine to read the value of the registry on a remote desktop. the key i am interested in is comment=("\\"&remotepc&"\hklm\system\CurrentContro lSet\Services\lanmanserver\parameter","srvcomment" )
but i can not get it to work.

 
Old October 27th, 2005, 12:23 PM
Friend of Wrox
 
Join Date: Mar 2004
Posts: 3,069
Thanks: 0
Thanked 10 Times in 10 Posts
Default

Hi,

   In order to do this you need to do the following:

1. Make sure all computers you want o run remote scripts on have WSH Version 5.6 or higher. Your computer must have this as well.

2. Make sure all the computers you want to run remote scripts on have the following registry entry:
   HKLM\Software\Microsoft\Windows Script Host\Settings
   "Remote"
   REG_SZ
   Value = 1

3. Then use WshController

Example:

Set objController = WScript.CreateObject("WshController")

Getting the value of the registry key from the remote script is problematic.

If this is something you need to get regularly from some remote computers, install a script locally, run the script at start up, maybe wait 5 mins to be sure the user is logged in good, and then report the value to a local database.

I use this technique a lot to great effect. Each computer reports to a SQL server at login, and once a month reports a whole list of hardware configurations, registry settings, software installed, printers installed, etc etc.

HTH


mmcdonal
 
Old October 28th, 2005, 02:18 PM
Registered User
 
Join Date: Oct 2005
Posts: 4
Thanks: 0
Thanked 0 Times in 0 Posts
Default

thank you mmcdonal,

After a long trial and error i found this code working for me. I would like to share it to you all. It was found on the technetsite of microsoft for VBS but it seems to work fine for AccessVBA; source http://www.microsoft.com/technet/scr.../osrgvb17.mspx

Here is the modified code;

Function fnReadTheDescription(machine)
On Error Resume Next

Const HKEY_LOCAL_MACHINE = &H80000002

Dim arrValues(0)

strComputer = machine

Set oReg = GetObject("winmgmts:{impersonationLevel=impersonat e}!\\" & strComputer & "\root\default:StdRegProv")

strKeyPath = "SYSTEM\CurrentControlSet\Services\lanmanserver\pa rameters"
strValueName = "srvcomment"

oReg.GetExpandedStringValue HKEY_LOCAL_MACHINE, strKeyPath, strValueName, strValue

arrValues(0) = "Description: " & strValue


fnReadTheDescription = arrValues


End Function






Similar Threads
Thread Thread Starter Forum Replies Last Post
Fetch Licence key from Remote Registry saumya Visual Studio 2005 0 December 3rd, 2007 11:32 PM
remote registry ingormation saumya Visual Studio 2005 0 November 28th, 2007 04:23 AM
remote registry access alex_smotritsky General .NET 2 November 28th, 2007 02:53 AM
Remote Registry Kep C++ Programming 3 September 18th, 2003 05:39 PM
Remote Registry Kep VB How-To 1 August 13th, 2003 04:18 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.