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