Directory Cleanup & Addition of Platform Scripts

This commit is contained in:
Andrew Amason
2025-05-14 13:25:48 -04:00
parent 5b9825e6dc
commit 1be4de9e7b
26 changed files with 1595 additions and 90 deletions

View File

@@ -0,0 +1,31 @@
function compareRegistryValue {
param (
[string]$path,
[string]$keyName,
[string]$value
)
$currentValue = (Get-ItemProperty -Path $path -Name $keyName).$keyName
if ($currentValue -eq $value) {
return $true
} else {
return $false
}
}
$thirtyTwo = compareRegistryValue -path "HKLM:\Software\Microsoft\Cryptography\Wintrust\Config" -keyName "EnableCertPaddingCheck" -value "1"
if ((Get-WmiObject win32_operatingsystem | select osarchitecture).osarchitecture -eq "64-bit") {
$sixtyFour = compareRegistryValue -path "HKLM:\Software\Wow6432Node\Microsoft\Cryptography\Wintrust\Config" -keyName "EnableCertPaddingCheck" -value "1"
} else {
$sixtyFour = $true
}
if ($thirtyTwo -and $sixtyFour) {
Write-Output "The registry key is set to the expected value."
exit 0
} else {
Write-Output "The registry key is not set to the expected value."
exit 1
}

View File

@@ -0,0 +1,27 @@
function createRegistryKey {
param (
[string]$path
)
New-Item -Path $path -Force
}
function setRegistryKey {
param (
[string]$path,
[string]$keyName,
[string]$value
)
Set-ItemProperty -Path $path -Name $keyName -Value $value
}
createRegistryKey -path "HKLM:\Software\Microsoft\Cryptography\Wintrust"
createRegistryKey -path "HKLM:\Software\Microsoft\Cryptography\Wintrust\Config"
setRegistryKey -path "HKLM:\Software\Microsoft\Cryptography\Wintrust\Config" -keyName "EnableCertPaddingCheck" -value "1"
if ((Get-WmiObject win32_operatingsystem | select osarchitecture).osarchitecture -eq "64-bit") {
createRegistryKey -path "HKLM:\Software\Wow6432Node\Microsoft\Cryptography\Wintrust"
createRegistryKey -path "HKLM:\Software\Wow6432Node\Microsoft\Cryptography\Wintrust\Config"
setRegistryKey -path "HKLM:\Software\Wow6432Node\Microsoft\Cryptography\Wintrust\Config" -keyName "EnableCertPaddingCheck" -value "1"
}