Skip to content

Commit

Permalink
Auto Format for better readability
Browse files Browse the repository at this point in the history
  • Loading branch information
qngngyn committed Aug 22, 2024
1 parent 8ee81ef commit e4ed2a2
Showing 1 changed file with 13 additions and 12 deletions.
25 changes: 13 additions & 12 deletions ATAPAuditor/ATAPAuditor.psm1
Original file line number Diff line number Diff line change
Expand Up @@ -139,13 +139,13 @@ function Start-ModuleTest {
#"SQLServer",
)
$missingModules = @()
foreach($module in $necessaryModules){
if($moduleList -notcontains $module){
foreach ($module in $necessaryModules) {
if ($moduleList -notcontains $module) {
$missingModules += $module
}
}

if($missingModules.Count -gt 0){
if ($missingModules.Count -gt 0) {
Write-Warning "Missing module(s) found. Missing modules can lead to errors. Following modules are missing:"
for ($i = 0; $i -lt $missingModules.Count; $i++) {
Write-Warning $missingModules[$i]
Expand All @@ -155,11 +155,11 @@ function Start-ModuleTest {

}

function GetLicenseStatus{
function GetLicenseStatus {
param(
$SkipLicenseCheck
)
if($SkipLicenseCheck -eq $false){
if ($SkipLicenseCheck -eq $false) {
Write-Host "Checking operating system activation status. This may take a while..."
$licenseStatus = (Get-CimInstance SoftwareLicensingProduct -Filter "Name like 'Windows%'" | where { $_.PartialProductKey } | select Description, LicenseStatus -ExpandProperty LicenseStatus)
switch ($licenseStatus) {
Expand All @@ -173,7 +173,7 @@ function GetLicenseStatus{
}
return $lcStatus
}
else{
else {
return "License check has been skipped."
}
}
Expand Down Expand Up @@ -352,7 +352,7 @@ function checkReportNameWithOSSystem {
# get whether domaincontroller info for later use
function IsDomainController {
$domainrole = Get-DomainRole
if ($domainrole -eq "Backup Domain Controller" -or $domainrole -eq "Primary Domain Controller"){
if ($domainrole -eq "Backup Domain Controller" -or $domainrole -eq "Primary Domain Controller") {
return $true
}
return $false
Expand All @@ -363,8 +363,9 @@ function checkReportNameWithOSSystem {
if (-not($isDomainController -eq $True)) {
return handleReportNameDiscrepancy -ReportName $ReportName -OsName $osName -ShouldBeDomainController $True
}
# should not be DC
} else {
# should not be DC
}
else {
if ($isDomainController -eq $True) {
return handleReportNameDiscrepancy -ReportName $ReportName -OsName $osName -ShouldNotBeDomainController $True
}
Expand Down Expand Up @@ -770,8 +771,8 @@ function Invoke-ATAPReport {
$script:loadedResources = @{}
# Load the module manifest

#Windows OS
try {
#Windows OS
if ([System.Environment]::OSVersion.Platform -ne 'Unix') {
$moduleInfo = Import-PowerShellDataFile -Path "$RootPath\ATAPAuditor.psd1"
[string]$ReportName = checkReportNameWithOSSystem -ReportName $ReportName
Expand All @@ -794,7 +795,7 @@ function Invoke-ATAPReport {
[Report]$report = (& "$RootPath/Reports/$ReportName.ps1")
}
}
catch [System.Management.Automation.CommandNotFoundException] {
catch [System.Management.Automation.CommandNotFoundException] {
Write-Host "Either your input for -Reportname is faulty or the report does not resolve due to a bug. Please report this bug with the following errormessage:
1. ErrorException: $_
2. PositionMessage: $($_.InvocationInfo.PositionMessage)
Expand Down Expand Up @@ -868,7 +869,7 @@ function Save-ATAPHtmlReport {
$Force
)

if([Environment]::Is64BitProcess -eq $false){
if ([Environment]::Is64BitProcess -eq $false) {
Write-Host "Please use 64-bit version of PowerShell in order to use AuditTAP. Closing..." -ForegroundColor red
return;
}
Expand Down

0 comments on commit e4ed2a2

Please sign in to comment.