0
我正在寻找基于其子项内找到的值更改注册表值。请看下面的图。注册表 - 搜索子值以更改父项值
- scripts
- {ID}
+ ScriptState = 0 #This is the value I am looking to change
- properties
+ {ID},E = 'Activated' #based on the values of these registry values
+ {ID},V = 'Hard Drive' #based on the values of these registry values
注:
+ = Value - = Key
所有的ID是随机产生的,和我有麻烦通过循环/获得随机产生的密钥ID列表。一旦我能够遍历这些关键ID,那么其余的应该相当容易。
下面是我正在使用的当前脚本,试图找到并过滤子键(改变父母的父键值尚未实现)。
V1:
Get-ChildItem -Path $key -rec | foreach {
Get-ChildItem -Path $_.PSPath -rec } | foreach {
$CurrentKey = (Get-ItemProperty -Path $_.PsPath) } |
select-string "REGEX TO FIND VALUES" -input $CurrentKey -AllMatches |
foreach {($_.matches)| select-object Value
}
V2:
Get-ChildItem -Path $key -rec | foreach {
Get-ChildItem -Path $_.PSPath -rec | foreach {
$CurrentKey = (Get-ItemProperty -Path $_.PsPath)
if ($CurrentKey -match "REGEX TO FIND VALUES") {
$CurrentKey
}
}}
无论上面的脚本产生任何结果,我希望有人可以帮我明白为什么他们不这样做,或提供/指向我将实现这一目标的代码。
P.S.对于这个无意义的标题感到抱歉,很难用几句话来形容这一点。
那么,什么是问题? :-) –
道歉,我忽略了最重要的部分。我现在用一个问题更新了问题... – Kickball