Improve the scripts

This commit is contained in:
Markus Fleschutz 2021-04-14 16:18:23 +02:00
parent e3c9ab459e
commit 980a169bfc
4 changed files with 11 additions and 15 deletions

View File

@ -7,7 +7,7 @@
#>
try {
$StartTime = Get-Date
$StartTime = get-date
write-progress "Reading Data/domain-names.csv..."
$PathToRepo = "$PSScriptRoot/.."
@ -21,12 +21,11 @@ try {
$Ignore = resolve-dnsName $Row.Domain
}
}
$Count = $Table.Length
$StopTime = Get-Date
$TimeInterval = New-Timespan -start $StartTime -end $StopTime
$Average = [math]::round($Count / $TimeInterval.seconds, 1)
write-host -foregroundColor green "OK - $Average domains/s ($Count domains resolved in $($TimeInterval.seconds) seconds)"
$Elapsed = New-Timespan -start $StartTime -end (get-date)
$Average = [math]::round($Count / $Elapsed.seconds, 1)
write-host -foregroundColor green "OK - $Average domains/s ($Count domains resolved in $($Elapsed.seconds) seconds)"
exit 0
} catch {
write-error "ERROR: line $($_.InvocationInfo.ScriptLineNumber): $($Error[0])"

View File

@ -30,9 +30,8 @@ try {
$Count++
}
$StopTime = get-date
$TimeSpan = new-timeSpan -start $StartTime -end $StopTime
write-host -foregroundColor green "OK - fetched updates for $Count Git repositories under $ParentDir in $($TimeSpan.seconds) second(s)"
$Elapsed = new-timeSpan -start $StartTime -end (get-date)
write-host -foregroundColor green "OK - fetched updates for $Count Git repositories under $ParentDir in $($Elapsed.seconds) second(s)"
exit 0
} catch {
write-error "ERROR: line $($_.InvocationInfo.ScriptLineNumber): $($Error[0])"

View File

@ -31,9 +31,8 @@ try {
$Count++
}
$StopTime = get-date
$TimeSpan = new-timeSpan -start $StartTime -end $StopTime
write-host -foregroundColor green "OK - pulled updates for $Count Git repositories under $ParentDir in $($TimeSpan.seconds) second(s)"
$Elapsed = new-timeSpan -start $StartTime -end (get-date)
write-host -foregroundColor green "OK - pulled updates for $Count Git repositories under $ParentDir in $($Elapsed.seconds) second(s)"
exit 0
} catch {
write-error "ERROR: line $($_.InvocationInfo.ScriptLineNumber): $($Error[0])"

View File

@ -46,9 +46,8 @@ try {
$ftpStream.Dispose()
$fileStream.Dispose()
$StopTime = get-date
$TimeInterval = New-Timespan -start $StartTime -end $StopTime
write-host -foregroundColor green "OK - uploaded $File to $URL in $($TimeInterval.seconds) second(s)"
$Elapsed = New-Timespan -start $StartTime -end (get-date)
write-host -foregroundColor green "OK - uploaded $File to $URL in $($Elapsed.seconds) second(s)"
exit 0
} catch {
write-error "ERROR: line $($_.InvocationInfo.ScriptLineNumber): $($Error[0])"