-
Notifications
You must be signed in to change notification settings - Fork 0
/
check_install_registry.ps1
executable file
·43 lines (42 loc) · 3.6 KB
/
check_install_registry.ps1
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
clear-host
function ConvertFrom-Json20([object] $item) {
add-type -assembly system.web.extensions
$ps_js = new-object system.web.script.serialization.javascriptSerializer
return ,$ps_js.DeserializeObject($item)
}
if ((Test-Path 'log_install_registry.txt') -eq 'True') {
clear-content 'log_install_registry.txt'
}
$failcheck = 'Passed'
$jsons = @('')
$count = 0
foreach ($file in $jsons) {
$json = Get-Content -Path $file
$hash = ConvertFrom-Json20($json)
foreach ($block in $hash) {
foreach ($key in $block.Keys){
if (-not (Get-ItemProperty -Path (echo $key) -ErrorAction SilentlyContinue)) {
'Ветка ' + $key + ' не найдена' >> log_install_registry.txt
}
foreach ($val in $block.$key) {
foreach ($inval in $val.Keys) {
if (((Get-ItemProperty -Path (echo $key) -ErrorAction SilentlyContinue).(echo $inval)) -ne ($block.$key.$inval) -And ((Get-ItemProperty -Path (echo $key) -ErrorAction SilentlyContinue).(echo $inval)) -And ($block.$key.$inval)) {
$key+ ', Ключ: '+$inval+'. Должно быть: '+$block.$key.$inval+' В реестре: '+(Get-ItemProperty -Path (echo $key)).(echo $inval) >> log_install_registry.txt
$failcheck = 'Failed'
}
$count += 1
clear-host
write-host 'Проверено ключей:' $count
}
}
}
}
}
if ($failcheck -eq 'Passed') {
write-host 'Установка завершена удачно.'
}
else {
write-host 'Установка завершилась неудачно. Подробности в log_install_registry.txt'
}
Write-Host "Для выхода нажмите любую клавишу"
cmd /c pause | out-null