cancel
Showing results for 
Search instead for 
Did you mean: 
Create Post
Level 10

Fetch Registry Settings

Hi Everyone,

I'm looking to fetch registry settings on a particular file path..? 

I know Power shell can be able to do it on SolarWinds via template. Have anyone tried this before..?

I need to fetch a report on the registries present.

 

Kindly suggest & help on the same.

 

Thank you..!!

 

Regards,

Solaiy.

Labels (3)
Tags (3)
0 Kudos
5 Replies
Level 17

Just wanted to update a detail I came across; This is also highlighted in the Orion documentation @ https://documentation.solarwinds.com/en/Success_Center/SAM/Content/SAM-Script-Report-Status-Through-...

0 Kudos
Level 17

Yes, I have done this before using the Windows Powershell Monitor and a simple script

And I have an example : https://thwack.solarwinds.com/t5/SAM-Documents/Windows-Update-Settings-via-Registry-Check/ta-p/53302...

It took me a few tries when I did this and was able to achieve once I abbreviated the Hives

the break out is as follows;

Arguments : Path, Value

ex: HKLM:\SOFTWARE\Policies\Microsoft\Windows\WindowsUpdate\AU\,NoAutoUpdate,1

Script used; (Using thresholds to Alert when values do not return as desired, and if Down the script failed)

param(
[string]$reg,
[string]$Key,
$target_value
)
$reg_value = Get-ItemProperty $reg -name $Key

Write-Host "Message: '$reg' is currently set to '$reg_value'"
if ($reg_value -match "$key=$target_value") {
Write-Host "Statistic: 0"
} else {
Write-Host "Statistic: 1"
}
Exit 0

Hello @cahunt,

Thanks much for your response. I have tried a combination of your response & could able to achieve what I'm looking for. But the output isn't perfect. Can you advise on the same please.

 

Requirement:

Need to fetch a registry URL set under particular "Key"

Example: on cmd prompt,

Input:

REG QUERY "HKLM\Software\Policies\Microsoft\Windows\WindowsUpdate" /v "WRServer"

 

Output:

HKEY_LOCAL_MACHINE\Software\Policies\Microsoft\Windows\WindowsUpdate
WRServer REG_SZ http://XXXX.XXX.XXXX.com:8530

 

Power Shell on Template:

param(
[string]$reg,
[string]$Key,
$target_value
)
$reg_value = REG QUERY "HKLM\Software\Policies\Microsoft\Windows\WindowsUpdate" /v "WRServer" $Key
Write-Host "Message: '$reg' is currently set to '$reg_value' ";
Write-Host "Statistic: '$stat' ";
Exit 0

 

Power Shell Output:

Output Result:
Message.Statistic:'"HKLM\Software\Policies\Microsoft\Windows\WindowsUpdate" /v "WRServer"' is currently set to ' HKEY_LOCAL_MACHINE\Software\Policies\Microsoft\Windows\WindowsUpdate WRServer REG_SZ http://XXXX.XXX.XXXX.com:8530

Statistic.Statictic: Nan

 

Is this Correct..? My Application monitor still states "unknown" with error undefined statistics mentioned.

Kindly suggest please.

 

Regards,

Solaiy.

0 Kudos

Okay, since your return is not a number(man) we are going to need a if then to check/verify the return.
*Currently I'm not at a console and on a device, so sorry I can't put this through ISE to confirm it all.

But adjust the if then to
If $reg_key = $key then {
Statistic = 0
} Else {
Statistic = 1
}


Also copy the output parts and place in each part of the conditional so whether we match or not you get the output messages and statistic for proper parse and readout.
Then status will be up if a match or down if not a match.

Hope this helps, and if you need more just reply. I'll be at a place where I can review this in full and test a little later today if you need.
- CharlesH

Hello @cahunt ,

 

Thanks much for the idea. I have combined my character output & static output. Now I could see the application status is UP.

 

Regards,

Solaiy