43 lines
1.2 KiB
PowerShell
43 lines
1.2 KiB
PowerShell
function Get-TimeConfiguration {
|
|
<#
|
|
.SYNOPSIS
|
|
Returns an OrderedDictionary that Represents the Time Configuration.
|
|
#>
|
|
|
|
[CmdletBinding()]
|
|
Param()
|
|
|
|
$logLead = (Get-LogLeadName);
|
|
$providerStopWatch = [System.Diagnostics.StopWatch]::StartNew()
|
|
|
|
$timeSettingDictionary = New-Object System.Collections.Specialized.OrderedDictionary
|
|
$timeDetails = New-Object System.Collections.Specialized.OrderedDictionary
|
|
|
|
Write-Verbose "$logLead : [$($providerStopWatch.Elapsed)] : Getting Time Configuration Details"
|
|
|
|
try {
|
|
|
|
$dateTime = Get-Date
|
|
$timeZone = Get-TimeZone
|
|
|
|
$timeDetails = New-Object PSObject -Property @{
|
|
"CurrentTime" = $dateTime.ToLongTimeString()
|
|
"CurrentDate" = $dateTime.Date
|
|
"CurrentTicks" = $dateTime.Ticks
|
|
"TimeZoneId" = $timeZone.Id
|
|
"TimeZoneName" = $timeZone.StandardName
|
|
"BaseUtcOffset" = $timeZone.BaseUtcOffset
|
|
}
|
|
}
|
|
catch {
|
|
|
|
$timeDetails["Error"] = $_.Exception.Message
|
|
}
|
|
|
|
$timeSettingDictionary.Add("TimeConfiguration", $timeDetails)
|
|
|
|
Write-Verbose "$logLead : [$($providerStopWatch.Elapsed)] : Provider Complete"
|
|
$providerStopWatch.Stop()
|
|
|
|
return $timeSettingDictionary
|
|
} |