From 32e3111f460c3ddfc3bac8e04b28dd8a70e51f1f Mon Sep 17 00:00:00 2001 From: thed1n <59671234+thed1n@users.noreply.github.com> Date: Thu, 13 Jan 2022 11:57:58 +0100 Subject: [PATCH] Update of validation of the ParameterSetNames The validation of the different parametersetnames didn't work so here is a suggestion to do the validation. Also the ComputerName did point to a $FileList variable that I changed to 'ComputerName' as ParameterSetName validation --- CVE-2021-44228-LOG4J/Invoke-TSxLOG4JRemote.ps1 | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/CVE-2021-44228-LOG4J/Invoke-TSxLOG4JRemote.ps1 b/CVE-2021-44228-LOG4J/Invoke-TSxLOG4JRemote.ps1 index 0eaccdc..a9f66d6 100644 --- a/CVE-2021-44228-LOG4J/Invoke-TSxLOG4JRemote.ps1 +++ b/CVE-2021-44228-LOG4J/Invoke-TSxLOG4JRemote.ps1 @@ -58,15 +58,15 @@ if (!(Test-Path -Path $WorkPath\LOG4JCollection)) { $TimeStamp = Get-Date -UFormat "%Y%m%d.%H%M%S" -If ($ADLookup) { +If ($PSCmdlet.ParameterSetName -eq 'AD') { $Computers = (Get-ADComputer -Filter { Enabled -eq $true -and OperatingSystem -like "*Server*" } -Properties DNSHostName | Select-Object DNSHostName).DNSHostName } -If ($FileList) { +If ($PSCmdlet.ParameterSetName -eq 'FileList') { $Computers = Get-Content -Path $FileList } -If ($FileList) { +If ($PSCmdlet.ParameterSetName -eq 'ComputerName') { $Computers = $ComputerName } @@ -181,4 +181,4 @@ $Object | Add-Member JobsStarted $i $Object | Add-Member JobsCompleted (Get-Job -Name "Invoke-RemoteLog4Check-$JobSuffix" | Where-Object State -eq Completed).Count $Object | Add-Member ComputersNotReacheble $Failed -$Object \ No newline at end of file +$Object