allow null values for HaltIfRunning variable
This commit is contained in:
@@ -129,7 +129,7 @@ param(
|
||||
#### $HaltIfRunning is a collection of app names which, if running, will prevent the script from running
|
||||
[Parameter(Mandatory=$false,ParameterSetName='live-ps')]
|
||||
[Parameter(Mandatory=$false,ParameterSetName='local')]
|
||||
[string[]]$HaltIfRunning,
|
||||
[string[]]$HaltIfRunning='null',
|
||||
#### $ForceClose will forcefully close all apps specified in $HaltIfRunning
|
||||
[Parameter(Mandatory=$false,ParameterSetName='live-ps')]
|
||||
[Parameter(Mandatory=$false,ParameterSetName='local')]
|
||||
@@ -137,13 +137,14 @@ param(
|
||||
)
|
||||
$LogName = $MyInvocation.MyCommand
|
||||
If ( $Arguments -eq "null" ) { $Arguments = $null }
|
||||
If ( $HaltIfRunning -eq "null" ) { $HaltIfRunning = $null }
|
||||
If ( $LivePSScript )
|
||||
{
|
||||
$URL = "https://dev.emberkom.com/emberkom/${Type}/raw/branch/master/${LivePSScript}.ps1"
|
||||
If ( !(IsURLValid -URL $URL) ) { Log "The specified script does not exist: ${LivePSScript}" -Name $LogName ; Exit }
|
||||
}
|
||||
If ( $Path ) { If ( !(Test-Path $Path) ) { Log "The specified script does not exist: ${Path}" -Name $LogName ; Exit } }
|
||||
If ( ($HaltIfRunning) -and ($ForceClose) -and ( !(IsAdmin) ) ) { Log "Cannot close dependent apps because this task does not have administrative privileges" -Name $LogName ; Exit }
|
||||
If ( ($HaltIfRunning -ne $null ) -and ($ForceClose) -and ( !(IsAdmin) ) ) { Log "Cannot close dependent apps because this task does not have administrative privileges" -Name $LogName ; Exit }
|
||||
If ( $HaltIfRunning )
|
||||
{
|
||||
$Halt = $false
|
||||
|
||||
Reference in New Issue
Block a user