Helpers/AuditGroupFunctions.ps1
#Helper function for 'Test-ASRRules' Function Test-RegistryValue ($regkey, $name) { if (Get-ItemProperty -Path $regkey -Name $name -ErrorAction Ignore) { $true } else { $false } } #This function is needed in AuditGroups, which check both paths of ASR-Rules. function Test-ASRRules { [CmdletBinding()] param ( [Parameter(Mandatory = $true)] [String] $Path, [Parameter(Mandatory = $true)] [String] $Value ) process { try { if (Test-Path -Path $Path) { return Test-RegistryValue $Path $Value } else { return $false } } catch { } } } #Returns Hyper-V status function CheckHyperVStatus { return (Get-WindowsOptionalFeature -Online -FeatureName "Microsoft-Hyper-V").State } |