@@ -2043,7 +2043,7 @@ function Get-CAHostObject {
20432043 [CmdletBinding ()]
20442044 param (
20452045 [parameter (
2046- Mandatory = $true ,
2046+ Mandatory ,
20472047 ValueFromPipeline = $true )]
20482048 [Microsoft.ActiveDirectory.Management.ADEntity []]$ADCSObjects ,
20492049 [System.Management.Automation.PSCredential ]$Credential ,
@@ -2053,20 +2053,20 @@ function Get-CAHostObject {
20532053 if ($Credential ) {
20542054 $ADCSObjects | Where-Object objectClass -Match ' pKIEnrollmentService' | ForEach-Object {
20552055 if ($_.CAHostDistinguishedName ) {
2056- Get-ADObject $_.CAHostDistinguishedName - Properties * - Server $ForestGC - Credential $Credential
2056+ Get-ADObject $_.CAHostDistinguishedName - Properties * - Server $ForestGC - Credential $Credential
20572057 }
20582058 else {
2059- Write-Warning " Get-CAHostObject: Unable to get information from $ ( $_.DisplayName ) "
2059+ Write-Warning " Get-CAHostObject: Unable to get information from $ ( $_.DisplayName ) "
20602060 }
20612061 }
20622062 }
20632063 else {
20642064 $ADCSObjects | Where-Object objectClass -Match ' pKIEnrollmentService' | ForEach-Object {
20652065 if ($_.CAHostDistinguishedName ) {
2066- Get-ADObject - Identity $_.CAHostDistinguishedName - Properties * - Server $ForestGC
2066+ Get-ADObject - Identity $_.CAHostDistinguishedName - Properties * - Server $ForestGC
20672067 }
20682068 else {
2069- Write-Warning " Get-CAHostObject: Unable to get information from $ ( $_.DisplayName ) "
2069+ Write-Warning " Get-CAHostObject: Unable to get information from $ ( $_.DisplayName ) "
20702070 }
20712071 }
20722072 }
@@ -3029,7 +3029,7 @@ function Set-AdditionalCAProperty {
30293029 [CmdletBinding (SupportsShouldProcess )]
30303030 param (
30313031 [parameter (
3032- Mandatory = $true ,
3032+ Mandatory ,
30333033 ValueFromPipeline = $true )]
30343034 [Microsoft.ActiveDirectory.Management.ADEntity []]$ADCSObjects ,
30353035 [PSCredential ]$Credential ,
@@ -3134,10 +3134,10 @@ function Set-AdditionalCAProperty {
31343134 $CAHostFQDN = (Get-ADObject - Filter { (Name -eq $CAHostName ) -and (objectclass -eq ' computer' ) } - Properties DnsHostname - Server $ForestGC ).DnsHostname
31353135 }
31363136 $ping = if ($CAHostFQDN ) {
3137- Test-Connection - ComputerName $CAHostFQDN - Count 1 - Quiet
3137+ Test-Connection - ComputerName $CAHostFQDN - Count 1 - Quiet
31383138 }
31393139 else {
3140- Write-Warning " Unable to resolve $ ( $_.Name ) Fully Qualified Domain Name (FQDN)"
3140+ Write-Warning " Unable to resolve $ ( $_.Name ) Fully Qualified Domain Name (FQDN)"
31413141 }
31423142 if ($ping ) {
31433143 try {
@@ -3727,23 +3727,23 @@ function Set-RiskRating {
37273727 switch ($Issue.objectClass ) {
37283728 # Being able to modify Root CA Objects is very bad.
37293729 ' certificationAuthority' {
3730- $RiskValue += 2 ; $RiskScoring += ' Root Certification Authority bject: +2'
3730+ $RiskValue += 2 ; $RiskScoring += ' Root Certification Authority bject: +2'
37313731 }
37323732 # Being able to modify Issuing CA Objects is also very bad.
37333733 ' pKIEnrollmentService' {
3734- $RiskValue += 2 ; $RiskScoring += ' Issuing Certification Authority Object: +2'
3734+ $RiskValue += 2 ; $RiskScoring += ' Issuing Certification Authority Object: +2'
37353735 }
37363736 # Being able to modify CA Hosts? Yeah... very bad.
37373737 ' computer' {
3738- $RiskValue += 2 ; $RiskScoring += ' Certification Authority Host Computer: +2'
3738+ $RiskValue += 2 ; $RiskScoring += ' Certification Authority Host Computer: +2'
37393739 }
37403740 # Being able to modify OIDs could result in ESC13 vulns.
37413741 ' msPKI-Enterprise-Oid' {
3742- $RiskValue += 1 ; $RiskScoring += ' OID: +1'
3742+ $RiskValue += 1 ; $RiskScoring += ' OID: +1'
37433743 }
37443744 # Being able to modify PKS containers is bad.
37453745 ' container' {
3746- $RiskValue += 1 ; $RiskScoring += ' Container: +1'
3746+ $RiskValue += 1 ; $RiskScoring += ' Container: +1'
37473747 }
37483748 }
37493749 }
@@ -3764,19 +3764,19 @@ function Set-RiskRating {
37643764 # Convert Value to Name
37653765 $RiskName = switch ($RiskValue ) {
37663766 { $_ -le 1 } {
3767- ' Informational'
3767+ ' Informational'
37683768 }
37693769 2 {
3770- ' Low'
3770+ ' Low'
37713771 }
37723772 3 {
3773- ' Medium'
3773+ ' Medium'
37743774 }
37753775 4 {
3776- ' High'
3776+ ' High'
37773777 }
37783778 { $_ -ge 5 } {
3779- ' Critical'
3779+ ' Critical'
37803780 }
37813781 }
37823782
@@ -4335,7 +4335,7 @@ Set-Acl -Path `$Path -AclObject `$ACL
43354335"@
43364336 }
43374337 4 {
4338- break
4338+ break
43394339 }
43404340 5 {
43414341 $Issue.Fix = @"
@@ -4670,15 +4670,15 @@ Function Write-HostColorized {
46704670 # * At least for now, we remain PSv2-COMPATIBLE.
46714671 # * Thus:
46724672 # * no `[ordered]`, `::new()`, `[pscustomobject]`, ...
4673- # * No implicit Boolean properties in [CmdletBinding()] and [Parameter()] attributes (`Mandatory = $true ` instead of just `Mandatory`)
4673+ # * No implicit Boolean properties in [CmdletBinding()] and [Parameter()] attributes (`Mandatory` instead of just `Mandatory`)
46744674 # ===
46754675
46764676 [CmdletBinding (DefaultParameterSetName = ' SingleColor' )]
46774677 param (
4678- [Parameter (ParameterSetName = ' SingleColor' , Position = 0 , Mandatory = $True )] [string []] $Pattern ,
4678+ [Parameter (ParameterSetName = ' SingleColor' , Position = 0 , Mandatory )] [string []] $Pattern ,
46794679 [Parameter (ParameterSetName = ' SingleColor' , Position = 1 )] [ConsoleColor ] $ForegroundColor = [ConsoleColor ]::Yellow,
46804680 [Parameter (ParameterSetName = ' SingleColor' , Position = 2 )] [ConsoleColor ] $BackgroundColor ,
4681- [Parameter (ParameterSetName = ' PerPatternColor' , Position = 0 , Mandatory = $True )] [System.Collections.IDictionary ] $PatternColorMap ,
4681+ [Parameter (ParameterSetName = ' PerPatternColor' , Position = 0 , Mandatory )] [System.Collections.IDictionary ] $PatternColorMap ,
46824682 [Parameter (ValueFromPipeline = $True )] $InputObject ,
46834683 [switch ] $WholeLine ,
46844684 [switch ] $SimpleMatch ,
@@ -4706,10 +4706,10 @@ Function Write-HostColorized {
47064706 # We precompile them for better performance with many input objects.
47074707 [System.Text.RegularExpressions.RegexOptions ] $reOpts =
47084708 if ($CaseSensitive ) {
4709- ' Compiled, ExplicitCapture'
4709+ ' Compiled, ExplicitCapture'
47104710 }
47114711 else {
4712- ' Compiled, ExplicitCapture, IgnoreCase'
4712+ ' Compiled, ExplicitCapture, IgnoreCase'
47134713 }
47144714
47154715 # Transform the dictionary:
@@ -4731,10 +4731,10 @@ Function Write-HostColorized {
47314731 }
47324732 $colorArgs = @ { }
47334733 if ($fg ) {
4734- $colorArgs [' ForegroundColor' ] = [ConsoleColor ] $fg
4734+ $colorArgs [' ForegroundColor' ] = [ConsoleColor ] $fg
47354735 }
47364736 if ($bg ) {
4737- $colorArgs [' BackgroundColor' ] = [ConsoleColor ] $bg
4737+ $colorArgs [' BackgroundColor' ] = [ConsoleColor ] $bg
47384738 }
47394739
47404740 # Consolidate the patterns into a single pattern with alternation ('|'),
@@ -4753,7 +4753,7 @@ Function Write-HostColorized {
47534753 }
47544754 }
47554755 catch {
4756- throw
4756+ throw
47574757 }
47584758
47594759 # Construct the arguments to pass to Out-String.
@@ -4776,7 +4776,7 @@ Function Write-HostColorized {
47764776 foreach ($m in $entry.Key.Matches ($_ )) {
47774777 @ { Index = $m.Index ; Text = $m.Value ; ColorArgs = $entry.Value }
47784778 if ($WholeLine ) {
4779- break patternLoop
4779+ break patternLoop
47804780 }
47814781 }
47824782 }
0 commit comments