2
我目前正在嘗試訪問註冊表,獲取所有與它的適當值的子鍵,然後用XML配置替換這些值。Powershell - 使用註冊表值查找和替換XML配置數據
例如:
在XML文檔下面的值存儲:
<Name = "Test" Value = "\\somelocation\TOKEN\Application" />
<Name = "Test1" Value = "\\somelocation\TOKEN\Deployment" />
註冊表項持有令牌值:
TOKEN = LifeCycleManagement
因此,我想使用「\ somelocation \ LifeCycleManagement *」替代「\ somelocation \ TOKEN *」的powershell
有什麼想法嗎?
目前我想下面的代碼:
$lineElement = @()
$regItems = Get-ItemProperty registrylocation
Get-ItemProperty registrylocation > c:\DEV\output.txt
$contents = Get-Content c:\DEV\output.txt
foreach ($line in $contents)
{
$line = $line -split(":")
$lineElement += $line[0]
}
foreach ($element in $lineElement)
{
$element
$regItems.$element
}
的$ regItems $元素不會返回任何結果。