mirror of
https://github.com/fleschutz/PowerShell.git
synced 2024-12-24 23:59:17 +01:00
Improve the scripts
This commit is contained in:
parent
e3c9ab459e
commit
980a169bfc
@ -7,7 +7,7 @@
|
|||||||
#>
|
#>
|
||||||
|
|
||||||
try {
|
try {
|
||||||
$StartTime = Get-Date
|
$StartTime = get-date
|
||||||
|
|
||||||
write-progress "Reading Data/domain-names.csv..."
|
write-progress "Reading Data/domain-names.csv..."
|
||||||
$PathToRepo = "$PSScriptRoot/.."
|
$PathToRepo = "$PSScriptRoot/.."
|
||||||
@ -21,12 +21,11 @@ try {
|
|||||||
$Ignore = resolve-dnsName $Row.Domain
|
$Ignore = resolve-dnsName $Row.Domain
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
$Count = $Table.Length
|
$Count = $Table.Length
|
||||||
$StopTime = Get-Date
|
|
||||||
$TimeInterval = New-Timespan -start $StartTime -end $StopTime
|
$Elapsed = New-Timespan -start $StartTime -end (get-date)
|
||||||
$Average = [math]::round($Count / $TimeInterval.seconds, 1)
|
$Average = [math]::round($Count / $Elapsed.seconds, 1)
|
||||||
write-host -foregroundColor green "OK - $Average domains/s ($Count domains resolved in $($TimeInterval.seconds) seconds)"
|
write-host -foregroundColor green "OK - $Average domains/s ($Count domains resolved in $($Elapsed.seconds) seconds)"
|
||||||
exit 0
|
exit 0
|
||||||
} catch {
|
} catch {
|
||||||
write-error "ERROR: line $($_.InvocationInfo.ScriptLineNumber): $($Error[0])"
|
write-error "ERROR: line $($_.InvocationInfo.ScriptLineNumber): $($Error[0])"
|
||||||
|
@ -30,9 +30,8 @@ try {
|
|||||||
$Count++
|
$Count++
|
||||||
}
|
}
|
||||||
|
|
||||||
$StopTime = get-date
|
$Elapsed = new-timeSpan -start $StartTime -end (get-date)
|
||||||
$TimeSpan = new-timeSpan -start $StartTime -end $StopTime
|
write-host -foregroundColor green "OK - fetched updates for $Count Git repositories under $ParentDir in $($Elapsed.seconds) second(s)"
|
||||||
write-host -foregroundColor green "OK - fetched updates for $Count Git repositories under $ParentDir in $($TimeSpan.seconds) second(s)"
|
|
||||||
exit 0
|
exit 0
|
||||||
} catch {
|
} catch {
|
||||||
write-error "ERROR: line $($_.InvocationInfo.ScriptLineNumber): $($Error[0])"
|
write-error "ERROR: line $($_.InvocationInfo.ScriptLineNumber): $($Error[0])"
|
||||||
|
@ -31,9 +31,8 @@ try {
|
|||||||
$Count++
|
$Count++
|
||||||
}
|
}
|
||||||
|
|
||||||
$StopTime = get-date
|
$Elapsed = new-timeSpan -start $StartTime -end (get-date)
|
||||||
$TimeSpan = new-timeSpan -start $StartTime -end $StopTime
|
write-host -foregroundColor green "OK - pulled updates for $Count Git repositories under $ParentDir in $($Elapsed.seconds) second(s)"
|
||||||
write-host -foregroundColor green "OK - pulled updates for $Count Git repositories under $ParentDir in $($TimeSpan.seconds) second(s)"
|
|
||||||
exit 0
|
exit 0
|
||||||
} catch {
|
} catch {
|
||||||
write-error "ERROR: line $($_.InvocationInfo.ScriptLineNumber): $($Error[0])"
|
write-error "ERROR: line $($_.InvocationInfo.ScriptLineNumber): $($Error[0])"
|
||||||
|
@ -46,9 +46,8 @@ try {
|
|||||||
$ftpStream.Dispose()
|
$ftpStream.Dispose()
|
||||||
$fileStream.Dispose()
|
$fileStream.Dispose()
|
||||||
|
|
||||||
$StopTime = get-date
|
$Elapsed = New-Timespan -start $StartTime -end (get-date)
|
||||||
$TimeInterval = New-Timespan -start $StartTime -end $StopTime
|
write-host -foregroundColor green "OK - uploaded $File to $URL in $($Elapsed.seconds) second(s)"
|
||||||
write-host -foregroundColor green "OK - uploaded $File to $URL in $($TimeInterval.seconds) second(s)"
|
|
||||||
exit 0
|
exit 0
|
||||||
} catch {
|
} catch {
|
||||||
write-error "ERROR: line $($_.InvocationInfo.ScriptLineNumber): $($Error[0])"
|
write-error "ERROR: line $($_.InvocationInfo.ScriptLineNumber): $($Error[0])"
|
||||||
|
Loading…
Reference in New Issue
Block a user