/build/static/layout/Breadcrumb_cap_w.png

[PS] Replacing an string with another string in the entries values of registry

HI

I have some registry key containing some entries of various formarts

I have to analyze only the REG_SZ values of the entries in these keys to find if a specific string is included in (not equal to) these values to replace this string with another string.

So how do I do this?

THANKS

BYE

0 Comments   [ + ] Show comments

Answers (5)

Posted by: anonymous_9363 13 years ago
Red Belt
0
You could do worse than start here.

Heard of Google, BTW? It was all I could do to resist sending the link above as a LMGTFY one...
Posted by: AngelD 13 years ago
Red Belt
0
For vbscript check out the InStr and Replace functions.
Posted by: anonymous_9363 13 years ago
Red Belt
0
Kim, the OP is using an emerging forum standard whereby, when posting to generic fora, you prefix your subject line with a hint. In this case, PS = PowerShell.
Posted by: AngelD 13 years ago
Red Belt
0
I see Ian, learning some new stuff today :)
Posted by: balubeto 13 years ago
Senior Yellow Belt
0
So if I write:


param($Key,$findval,$repval)

function RepEntryValue ($Key,$findval,$repval)
{
$GetKey = Get-Item $Key
$prop = Get-Itemproperty $GetKey.pspath
$strprops = @{}
$strprops = $GetKey.property | where { $prop.$_.gettype().name -eq "String"}
$strprops | $_ -replace $findval $repval
}

RepEntryValue -Key 'Key analyzed' -findval 'Value searched' -repval 'Value replaced'


I reach my goal?

THANKS

BYE
Rating comments in this legacy AppDeploy message board thread won't reorder them,
so that the conversation will remain readable.
 
This website uses cookies. By continuing to use this site and/or clicking the "Accept" button you are providing consent Quest Software and its affiliates do NOT sell the Personal Data you provide to us either when you register on our websites or when you do business with us. For more information about our Privacy Policy and our data protection efforts, please visit GDPR-HQ