cleared some warnings in the IDE
This commit is contained in:
@@ -106,12 +106,12 @@ Function Run-Script {
|
|||||||
If ( !(IsURLValid -URL $URL) ) { LogMsg "The specified script does not exist: ${LivePSScript}" ; Exit }
|
If ( !(IsURLValid -URL $URL) ) { LogMsg "The specified script does not exist: ${LivePSScript}" ; Exit }
|
||||||
}
|
}
|
||||||
If ( $Path ) { If ( !(Test-Path $Path) ) { LogMsg "The specified script does not exist: ""${Path}""" ; Exit } }
|
If ( $Path ) { If ( !(Test-Path $Path) ) { LogMsg "The specified script does not exist: ""${Path}""" ; Exit } }
|
||||||
If ( ($HaltIfRunning -ne $null ) -and ($ForceClose) -and ( !(IsAdmin) ) ) { LogMsg "Cannot close dependent apps because this task does not have administrative privileges" ; Exit }
|
If ( ($null -ne $HaltIfRunning ) -and ($ForceClose) -and ( !(IsAdmin) ) ) { LogMsg "Cannot close dependent apps because this task does not have administrative privileges" ; Exit }
|
||||||
If ( $HaltIfRunning ) {
|
If ( $HaltIfRunning ) {
|
||||||
$Halt = $false
|
$Halt = $false
|
||||||
LogMsg "Checking for running instances of the following dependent apps:"
|
LogMsg "Checking for running instances of the following dependent apps:"
|
||||||
ForEach ( $name in $HaltIfRunning) {
|
ForEach ( $name in $HaltIfRunning) {
|
||||||
$RunningInstances = Get-Process | Where { $_.Name -like "${name}" }
|
$RunningInstances = Get-Process | Where-Object { $_.Name -like "${name}" }
|
||||||
If ( $RunningInstances ) {
|
If ( $RunningInstances ) {
|
||||||
If ( $ForceClose -eq $true ) {
|
If ( $ForceClose -eq $true ) {
|
||||||
Try { $name | Stop-Process -Force ; LogMsg " ""${name}"" (force closed)" }
|
Try { $name | Stop-Process -Force ; LogMsg " ""${name}"" (force closed)" }
|
||||||
@@ -428,7 +428,7 @@ Function End-Process
|
|||||||
LogMsg "Cannot find the process '${item}'"
|
LogMsg "Cannot find the process '${item}'"
|
||||||
If ( $Match ) {
|
If ( $Match ) {
|
||||||
LogMsg "Attempting to match '${item}' to all running process names"
|
LogMsg "Attempting to match '${item}' to all running process names"
|
||||||
ForEach ( $proc in ((Get-Process | Where { $_.Name -match $item }).Name) ) {
|
ForEach ( $proc in ((Get-Process | Where-Object { $_.Name -match $item }).Name) ) {
|
||||||
If ( $Force ) { End-Process -Name $proc -Force } Else { End-Process -Name $proc }
|
If ( $Force ) { End-Process -Name $proc -Force } Else { End-Process -Name $proc }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -24,7 +24,7 @@ Function Test-ItemProperty {
|
|||||||
param([Parameter(Mandatory=$true)][string]$Path,[Parameter(Mandatory=$true)][string]$Name)
|
param([Parameter(Mandatory=$true)][string]$Path,[Parameter(Mandatory=$true)][string]$Name)
|
||||||
Try {
|
Try {
|
||||||
$test = Get-ItemProperty -Path $Path -Name $Name -ErrorAction SilentlyContinue
|
$test = Get-ItemProperty -Path $Path -Name $Name -ErrorAction SilentlyContinue
|
||||||
If (($test -eq $null) -or ($test.Length -eq 0)) { Return $false } Else { Return $true }
|
If (($null -eq $test) -or ($test.Length -eq 0)) { Return $false } Else { Return $true }
|
||||||
}
|
}
|
||||||
Catch { Return $false }
|
Catch { Return $false }
|
||||||
}
|
}
|
||||||
@@ -61,7 +61,7 @@ Function Get-ItemPropertyInfo {
|
|||||||
|
|
||||||
# Make sure $formatstring has a value, if not just try to cast directly to a datetime
|
# Make sure $formatstring has a value, if not just try to cast directly to a datetime
|
||||||
Try {
|
Try {
|
||||||
If ( $formatstring -eq $null ) {
|
If ( $null -eq $formatstring ) {
|
||||||
$date = [datetime]$retval
|
$date = [datetime]$retval
|
||||||
} Else {
|
} Else {
|
||||||
$date = [datetime]::ParseExact($retval,$formatstring,$null)
|
$date = [datetime]::ParseExact($retval,$formatstring,$null)
|
||||||
|
|||||||
Reference in New Issue
Block a user