102 lines
2.7 KiB
PowerShell
102 lines
2.7 KiB
PowerShell
cls
|
|
|
|
#Test Registry Keys for existens
|
|
|
|
$RegistryTest = (Test-Path -Path "HKCU:\Software\Digital Data")
|
|
|
|
IF ($RegistryTest -eq 'TRUE') {
|
|
|
|
Write-Host "Digital data gibts!"
|
|
$RegistryTest = (Test-Path -Path "HKCU:\Software\Digital Data\TileMenu_Builder")
|
|
|
|
IF ($RegistryTest -eq 'TRUE') {
|
|
|
|
Write-Host "TileMenu_Builder gibts auch!"
|
|
$RegistryTest = (Test-Path -Path "HKCU:\Software\Digital Data\TileMenu_Builder\$env:computername")
|
|
|
|
IF ($RegistryTest -eq 'TRUE') {
|
|
|
|
Write-Host "$env:computername gibts sogar auch!"
|
|
|
|
} #end if
|
|
|
|
ELSE {
|
|
|
|
New-Item -Path "HKCU:\Software\Digital Data\TileMenu_Builder" -Name "$env:computername"
|
|
|
|
Set-ItemProperty -Path "HKCU:\Software\Digital Data\TileMenu_Builder\$env:computername" -Name InstallerCount -Value (get-Item -path HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\Installer\Folders).ValueCount
|
|
|
|
} #end else
|
|
|
|
} #end if
|
|
|
|
ELSE {
|
|
|
|
New-Item -Path "HKCU:\Software\Digital Data" -Name "TileMenu_Builder"
|
|
New-Item -Path "HKCU:\Software\Digital Data\TileMenu_Builder" -Name "$env:computername"
|
|
|
|
Set-ItemProperty -Path "HKCU:\Software\Digital Data\TileMenu_Builder\$env:computername" -Name InstallerCount -Value (get-Item -path HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\Installer\Folders).ValueCount
|
|
|
|
} #end else
|
|
|
|
} #end if
|
|
|
|
ELSE {
|
|
|
|
Try {
|
|
|
|
New-Item -Path "HKCU:\Software" -Name "Digital Data"
|
|
New-Item -Path "HKCU:\Software\Digital Data" -Name "TileMenu_Builder"
|
|
New-Item -Path "HKCU:\Software\Digital Data\TileMenu_Builder" -Name "$env:computername"
|
|
|
|
Set-ItemProperty -Path "HKCU:\Software\Digital Data\TileMenu_Builder\$env:computername" -Name InstallerCount -Value (get-Item -path HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\Installer\Folders).ValueCount
|
|
|
|
} #end try
|
|
|
|
catch {
|
|
|
|
Write-Host "Reg nocht möglich!"
|
|
|
|
} #end catch
|
|
|
|
} #end else
|
|
|
|
exit
|
|
|
|
# Get Software counter from User Registry
|
|
$InstallerCount_old = (Get-ItemProperty -Path "HKCU:\Software\Digital Data\TileMenu_Builder\$env:computername" -name InstallerCount).InstallerCount
|
|
write-host "Test:" $InstallerCount_old
|
|
|
|
$InstallerCount_new = (get-Item -path HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\Installer\Folders).ValueCount
|
|
|
|
write-host "Test:" $InstallerCount_new
|
|
|
|
|
|
IF ($InstallerCount_old -ne $InstallerCount_new) {
|
|
|
|
Write-host "Werte sind ungleich!"
|
|
|
|
#### Hauptprogramm
|
|
|
|
|
|
} #end if
|
|
|
|
ELSEIF ($InstallerCount_old -eq $InstallerCount_new) {
|
|
|
|
Write-Host "Werte sind gleich"
|
|
Write-Host "Es sind keine Maßnahmen nötig!"
|
|
|
|
} #end elseif
|
|
|
|
ELSE {
|
|
|
|
Write-Host "ERROR!"
|
|
|
|
} #end else
|
|
|
|
|
|
exit
|
|
Remove-Variable *
|
|
$error.clear
|
|
cls
|