1
+ <#
2
+ Copyright 2017 Ryan Butler
3
+
4
+ Licensed under the Apache License, Version 2.0 (the "License");
5
+ you may not use this file except in compliance with the License.
6
+ You may obtain a copy of the License at
7
+
8
+ http://www.apache.org/licenses/LICENSE-2.0
9
+
10
+ Unless required by applicable law or agreed to in writing, software
11
+ distributed under the License is distributed on an "AS IS" BASIS,
12
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
+ See the License for the specific language governing permissions and
14
+ limitations under the License.
15
+ #>
16
+ function Get-NSCurrentTime {
17
+ <#
18
+ . SYNOPSIS
19
+ Retrieve the current NetScaler Time and returns as date object
20
+ . DESCRIPTION
21
+ Retrieve the current NetScaler Time and returns as date object
22
+ . PARAMETER NSSession
23
+ An existing custom NetScaler Web Request Session object returned by Connect-NSAppliance
24
+ . EXAMPLE
25
+ Get-NSCurrentTime -NSSession $Session
26
+ . NOTES
27
+ Author: Ryan Butler - @ryan_c_butler
28
+ Date Created: 09-07-2017
29
+ #>
30
+ [CmdletBinding ()]
31
+ param (
32
+ [Parameter (Mandatory = $true )] [PSObject ]$Session
33
+ )
34
+
35
+ begin {
36
+ _AssertSessionActive
37
+ }
38
+
39
+ process {
40
+ $response = _InvokeNSRestApi - Session $Session - Method GET - Type nsconfig
41
+ $currentdatestr = $response.nsconfig.systemtime
42
+ Write-Verbose " systemtime: $currentdatestr "
43
+ $date = get-date " 1/1/1970"
44
+ $nsdate = $date.AddSeconds ($currentdatestr )
45
+ }
46
+
47
+ end {
48
+ return $nsdate
49
+ }
50
+ }
0 commit comments