Skip to content

Commit

Permalink
Merge pull request #2232 from iserrano76/AMSI
Browse files Browse the repository at this point in the history
Fix execution without parameters and servername
  • Loading branch information
dpaulson45 authored Nov 27, 2024
2 parents 293e235 + 6615883 commit 1661fa5
Showing 1 changed file with 9 additions and 5 deletions.
14 changes: 9 additions & 5 deletions Admin/Test-AMSI.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -116,11 +116,11 @@ param(
[Parameter(ParameterSetName = 'RestartIISAll', Mandatory = $true)]
[switch]$RestartIIS,
[Alias("ExchangeServerFQDN")]
[Parameter(ParameterSetName = 'TestAMSI', Mandatory = $false, ValueFromPipeline = $true)]
[Parameter(ParameterSetName = 'EnableAMSI', Mandatory = $false, ValueFromPipeline = $true)]
[Parameter(ParameterSetName = 'DisableAMSI', Mandatory = $false, ValueFromPipeline = $true)]
[Parameter(ParameterSetName = 'CheckAMSIConfig', Mandatory = $false, ValueFromPipeline = $true)]
[Parameter(ParameterSetName = 'RestartIIS', Mandatory = $false, ValueFromPipeline = $true)]
[Parameter(Position = 0, ParameterSetName = 'TestAMSI', Mandatory = $false, ValueFromPipeline = $true)]
[Parameter(Position = 0, ParameterSetName = 'EnableAMSI', Mandatory = $false, ValueFromPipeline = $true)]
[Parameter(Position = 0, ParameterSetName = 'DisableAMSI', Mandatory = $false, ValueFromPipeline = $true)]
[Parameter(Position = 0, ParameterSetName = 'CheckAMSIConfig', Mandatory = $false, ValueFromPipeline = $true)]
[Parameter(Position = 0, ParameterSetName = 'RestartIIS', Mandatory = $false, ValueFromPipeline = $true)]
[string[]]$ServerList = $null,
[Parameter(ParameterSetName = 'TestAMSIAll', Mandatory = $true)]
[Parameter(ParameterSetName = 'CheckAMSIConfigAll', Mandatory = $true)]
Expand Down Expand Up @@ -154,6 +154,10 @@ param(

begin {

if (-not $ServerList -and $args.Count -gt 0) {
$ServerList = @($args[0])
}

. $PSScriptRoot\..\Shared\Confirm-Administrator.ps1
. $PSScriptRoot\..\Shared\Confirm-ExchangeShell.ps1
. $PSScriptRoot\..\Shared\Invoke-ScriptBlockHandler.ps1
Expand Down

0 comments on commit 1661fa5

Please sign in to comment.