Private/Stop-AS2GoDemo.ps1
|
function Stop-AS2GoDemo { [CmdletBinding()] Param( [Parameter(Mandatory = $False)] [string]$NextStepReboot = $no ) $CurrentFunction = Get-FunctionName Write-Log -Message "### Start Function $CurrentFunction ###" $StartRunTime = (Get-Date).ToString($Script:DateFormatLog) #################### main code | out- host ##################### If (-not $SkipClearHost) { Clear-Host } $closing = "DONE!" Invoke-Output -Type Success -Message $closing Update-WindowTitle -NewTitle $closing $StartDate = Get-KeyValue -key "LastStart" $EndDate = (Get-Date).toString("yyyy-MM-dd HH:mm:ss") $duration = NEW-TIMESPAN -Start $StartDate -End $EndDate Write-host "finished after $duration [h]" Set-KeyValue -key "LastStage" -NewValue $Script:Phase50 Set-KeyValue -key "LastFinished" -NewValue $enddate Set-KeyValue -key "LastDuration" -NewValue "$duration [h]" Write-Log -Message "Start Time: $StartDate" Write-Log -Message "End Time : $EndDate" Write-Log -Message "Total Time: $duration" # clean-up AS2Go Folder New-Item -Path $Script:DefautCleanUpFolder -ItemType Directory -ErrorAction Ignore | Out-Null try { Get-ChildItem ??-*.* -Path $Script:DefautExfiltrationFolder | Move-Item -Destination $Script:DefautCleanUpFolder -Force | Out-Null } catch { } if (Test-Path $Script:ASModuleLog) { #Invoke-Item $Script:ASModuleLog } If (-not $SkipImages) { #Show-Phases -Phase "phase_020.html" } If ($NextStepReboot -ne $yes) { return } Write-Log -Message " >> using " ######################## main code ############################ $runtime = Get-RunTime -StartRunTime $StartRunTime Write-Log -Message " Run Time: $runtime [h] ###" Write-Log -Message "### End Function $CurrentFunction ###" } |