PC Review


Reply
Thread Tools Rate Thread

Accessing Remote registry in Excel

 
 
newsgroups.jd@gmail.com
Guest
Posts: n/a
 
      1st Aug 2008
I have a list of servers in excel and I would like to access a few
registry setting on each server and write that value to other column.
Can anyone help with this? I do not need to write to the registry,
just read.

Thanks in advance
 
Reply With Quote
 
 
 
 
Dave Peterson
Guest
Posts: n/a
 
      2nd Aug 2008
Look at GetSetting in VBA's help. It has an example, too.

(E-Mail Removed) wrote:
>
> I have a list of servers in excel and I would like to access a few
> registry setting on each server and write that value to other column.
> Can anyone help with this? I do not need to write to the registry,
> just read.
>
> Thanks in advance


--

Dave Peterson
 
Reply With Quote
 
Dave Peterson
Guest
Posts: n/a
 
      2nd Aug 2008
Ignore that last post. It'll work if you want to save or retrieve a setting for
your VBA program--but it's not used for accessing the registry in general:

Option Explicit

Sub testme()
Dim wsh As Object
Dim RegStr As String
Dim RegVal As String

RegStr = "HKLM\Software\Microsoft\mediaplayer\" _
& "settings\mp3encoding\PreferredCodecName"

Set wsh = CreateObject("WScript.Shell")

RegVal = "not found!!!!"
On Error Resume Next
RegVal = wsh.RegRead(RegStr)
On Error GoTo 0

If RegVal = "not found!!!!" Then
MsgBox "key wasn't found"
Else
MsgBox RegVal
End If
End Sub



(E-Mail Removed) wrote:
>
> I have a list of servers in excel and I would like to access a few
> registry setting on each server and write that value to other column.
> Can anyone help with this? I do not need to write to the registry,
> just read.
>
> Thanks in advance


--

Dave Peterson
 
Reply With Quote
 
Dave Peterson
Guest
Posts: n/a
 
      2nd Aug 2008
Ahhhh.

Please ignore both these posts.

I have no idea how to access the registry on a server.

If you don't get a real answer in this newsgroup, you may want to post in a VB
newsgroup--explain that you want to use it in excel's VBA and maybe you'll get a
response you don't have to tweak.

Dave Peterson wrote:
>
> Ignore that last post. It'll work if you want to save or retrieve a setting for
> your VBA program--but it's not used for accessing the registry in general:
>
> Option Explicit
>
> Sub testme()
> Dim wsh As Object
> Dim RegStr As String
> Dim RegVal As String
>
> RegStr = "HKLM\Software\Microsoft\mediaplayer\" _
> & "settings\mp3encoding\PreferredCodecName"
>
> Set wsh = CreateObject("WScript.Shell")
>
> RegVal = "not found!!!!"
> On Error Resume Next
> RegVal = wsh.RegRead(RegStr)
> On Error GoTo 0
>
> If RegVal = "not found!!!!" Then
> MsgBox "key wasn't found"
> Else
> MsgBox RegVal
> End If
> End Sub
>
> (E-Mail Removed) wrote:
> >
> > I have a list of servers in excel and I would like to access a few
> > registry setting on each server and write that value to other column.
> > Can anyone help with this? I do not need to write to the registry,
> > just read.
> >
> > Thanks in advance

>
> --
>
> Dave Peterson


--

Dave Peterson
 
Reply With Quote
 
EagleOne@discussions.microsoft.com
Guest
Posts: n/a
 
      2nd Aug 2008
You sure try hard and solve most!

Dave Peterson <(E-Mail Removed)> wrote:

>Ahhhh.
>
>Please ignore both these posts.
>
>I have no idea how to access the registry on a server.
>
>If you don't get a real answer in this newsgroup, you may want to post in a VB
>newsgroup--explain that you want to use it in excel's VBA and maybe you'll get a
>response you don't have to tweak.
>
>Dave Peterson wrote:
>>
>> Ignore that last post. It'll work if you want to save or retrieve a setting for
>> your VBA program--but it's not used for accessing the registry in general:
>>
>> Option Explicit
>>
>> Sub testme()
>> Dim wsh As Object
>> Dim RegStr As String
>> Dim RegVal As String
>>
>> RegStr = "HKLM\Software\Microsoft\mediaplayer\" _
>> & "settings\mp3encoding\PreferredCodecName"
>>
>> Set wsh = CreateObject("WScript.Shell")
>>
>> RegVal = "not found!!!!"
>> On Error Resume Next
>> RegVal = wsh.RegRead(RegStr)
>> On Error GoTo 0
>>
>> If RegVal = "not found!!!!" Then
>> MsgBox "key wasn't found"
>> Else
>> MsgBox RegVal
>> End If
>> End Sub
>>
>> (E-Mail Removed) wrote:
>> >
>> > I have a list of servers in excel and I would like to access a few
>> > registry setting on each server and write that value to other column.
>> > Can anyone help with this? I do not need to write to the registry,
>> > just read.
>> >
>> > Thanks in advance

>>
>> --
>>
>> Dave Peterson

 
Reply With Quote
 
Dave Peterson
Guest
Posts: n/a
 
      2nd Aug 2008
Lots of times, it's easier to answer the questions you read--instead of the
question they write <vbg>.

(E-Mail Removed) wrote:
>
> You sure try hard and solve most!
>
> Dave Peterson <(E-Mail Removed)> wrote:
>
> >Ahhhh.
> >
> >Please ignore both these posts.
> >
> >I have no idea how to access the registry on a server.
> >
> >If you don't get a real answer in this newsgroup, you may want to post in a VB
> >newsgroup--explain that you want to use it in excel's VBA and maybe you'll get a
> >response you don't have to tweak.
> >
> >Dave Peterson wrote:
> >>
> >> Ignore that last post. It'll work if you want to save or retrieve a setting for
> >> your VBA program--but it's not used for accessing the registry in general:
> >>
> >> Option Explicit
> >>
> >> Sub testme()
> >> Dim wsh As Object
> >> Dim RegStr As String
> >> Dim RegVal As String
> >>
> >> RegStr = "HKLM\Software\Microsoft\mediaplayer\" _
> >> & "settings\mp3encoding\PreferredCodecName"
> >>
> >> Set wsh = CreateObject("WScript.Shell")
> >>
> >> RegVal = "not found!!!!"
> >> On Error Resume Next
> >> RegVal = wsh.RegRead(RegStr)
> >> On Error GoTo 0
> >>
> >> If RegVal = "not found!!!!" Then
> >> MsgBox "key wasn't found"
> >> Else
> >> MsgBox RegVal
> >> End If
> >> End Sub
> >>
> >> (E-Mail Removed) wrote:
> >> >
> >> > I have a list of servers in excel and I would like to access a few
> >> > registry setting on each server and write that value to other column.
> >> > Can anyone help with this? I do not need to write to the registry,
> >> > just read.
> >> >
> >> > Thanks in advance
> >>
> >> --
> >>
> >> Dave Peterson


--

Dave Peterson
 
Reply With Quote
 
Tim Williams
Guest
Posts: n/a
 
      2nd Aug 2008
Try the vbscript group: this is the type of thing vbscript gets used for a
lot.

Tim

<(E-Mail Removed)> wrote in message
news:c3849139-59f2-4c93-a6e7-(E-Mail Removed)...
>I have a list of servers in excel and I would like to access a few
> registry setting on each server and write that value to other column.
> Can anyone help with this? I do not need to write to the registry,
> just read.
>
> Thanks in advance



 
Reply With Quote
 
newsgroups.jd@gmail.com
Guest
Posts: n/a
 
      6th Aug 2008


Thanks
 
Reply With Quote
 
newsgroups.jd@gmail.com
Guest
Posts: n/a
 
      6th Aug 2008
On Aug 6, 8:54*am, newsgroups...@gmail.com wrote:
> Thanks


I got a VBS script to work pulling remote registry data - could you
guys help me now figure ut how to put this into excel please??


-- code --


On Error Resume Next

Const HKEY_LOCAL_MACHINE = &H80000002

strComputer = "remoteServer"
Set objReg = GetObject("winmgmts:\\" & strComputer & "\root
\default:StdRegProv")
strKeyPath = "SOFTWARE\AssetInfo"

AssetTag = "AssetTag"
SerialNumber = "SerialNumber"

objReg.GetStringValue HKEY_LOCAL_MACHINE, strKeyPath, AssetTag,
strValue1
objReg.GetStringValue HKEY_LOCAL_MACHINE, strKeyPath,
SerialNumber, strValue2

Wscript.Echo strValue1
Wscript.Echo strValue2


-- code --

Now I jsut need it to pull the strComputer from like excel cell A2 and
then instead of echo put the value in B2 and so on...

Thanks in advance.


JD
 
Reply With Quote
 
Dave Peterson
Guest
Posts: n/a
 
      6th Aug 2008
Untested, but it did compile:

Option Explicit
Sub testme02()

Dim myRng As Range
Dim myCell As Range
Dim strValue1 As String
Dim strValue2 As String
Dim strComputer As String
Dim objReg As Object
Dim strKeyPath As String
Dim AssetTag As String
Dim SerialNumber As String

Const HKEY_LOCAL_MACHINE = &H80000002

With Worksheets("sheet1")
Set myRng = .Range("a2", .Cells(.Rows.Count, "A").End(xlUp))
End With

On Error Resume Next
For Each myCell In myRng.Cells

strComputer = myCell.Value
Set objReg = GetObject("winmgmts:\\" & strComputer _
& "\root\default:StdRegProv")
strKeyPath = "SOFTWARE\AssetInfo"

AssetTag = "AssetTag"
SerialNumber = "SerialNumber"

objReg.GetStringValue HKEY_LOCAL_MACHINE, strKeyPath, _
AssetTag, strValue1

objReg.GetStringValue HKEY_LOCAL_MACHINE, strKeyPath, _
SerialNumber, strValue2

myCell.Offset(0, 1).Value = strValue1
myCell.Offset(0, 2).Value = strValue2

Next myCell
On Error GoTo 0

End Sub

(E-Mail Removed) wrote:
>
> On Aug 6, 8:54 am, newsgroups...@gmail.com wrote:
> > Thanks

>
> I got a VBS script to work pulling remote registry data - could you
> guys help me now figure ut how to put this into excel please??
>
> -- code --
>
> On Error Resume Next
>
> Const HKEY_LOCAL_MACHINE = &H80000002
>
> strComputer = "remoteServer"
> Set objReg = GetObject("winmgmts:\\" & strComputer & "\root
> \default:StdRegProv")
> strKeyPath = "SOFTWARE\AssetInfo"
>
> AssetTag = "AssetTag"
> SerialNumber = "SerialNumber"
>
> objReg.GetStringValue HKEY_LOCAL_MACHINE, strKeyPath, AssetTag,
> strValue1
> objReg.GetStringValue HKEY_LOCAL_MACHINE, strKeyPath,
> SerialNumber, strValue2
>
> Wscript.Echo strValue1
> Wscript.Echo strValue2
>
> -- code --
>
> Now I jsut need it to pull the strComputer from like excel cell A2 and
> then instead of echo put the value in B2 and so on...
>
> Thanks in advance.
>
> JD


--

Dave Peterson
 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Accessing a remote registry. Paulers Microsoft VB .NET 0 10th Dec 2008 06:16 PM
Accessing Remote Registry =?Utf-8?B?Q2hlcnJ5?= Microsoft Dot NET 1 25th Feb 2005 09:31 AM
Accessing remote registry in different domain JA Microsoft Windows 2000 Registry Archive 0 10th Feb 2005 12:34 AM
Accessing remote registry in different domain JA Microsoft Windows 2000 Registry 0 10th Feb 2005 12:34 AM
SecurityPermission (Accessing remote registry key) Terry Olsen Microsoft VB .NET 1 31st Mar 2004 10:50 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 08:10 PM.