Hi,<\/p>\n
We are trying to monitor time skew between our servers using SolarWinds, the out-of-the-box PowerShell script (attached) is giving the below error.<\/p>\n
Output: ==============================================
\nMessage: Try to rerrun script. Error: Exception calling “ParseExact” with “3” argument(s): “String was not recognized as a valid DateTime.”<\/p>\n
Errors: ==============================================
\nException calling “Connect” with “2” argument(s): “A connection attempt failed because the connected party did not properly respond after a period of time, or established connection failed because connected host has failed to respond 192.168.116.234:13”
\nAt line:5 char:2<\/p>\n
<\/code><\/pre>\n<\/li>\n- CategoryInfo : NotSpecified: (
<\/span>, MethodInvocationException<\/li>\n- FullyQualifiedErrorId : SocketException<\/li>\n<\/ul>\n
Exception calling “GetStream” with “0” argument(s): “The operation is not allowed on non-connected sockets.”
\nAt line:6 char:2<\/p>\n
\n- $TcpStream = $TcpClient.GetStream()<\/li>\n
- \n
<\/code><\/pre>\n<\/li>\n- CategoryInfo : NotSpecified: (
<\/span>, MethodInvocationException<\/li>\n- FullyQualifiedErrorId : InvalidOperationException<\/li>\n<\/ul>\n
You cannot call a method on a null-valued expression.
\nAt line:7 char:2<\/p>\n
\n- $length = $TcpStream.Read($buffer, 0, $buffer.Length);<\/li>\n
- \n
<\/code><\/pre>\n<\/li>\n- CategoryInfo : InvalidOperation: (
<\/span>, RuntimeException<\/li>\n- FullyQualifiedErrorId : InvokeMethodOnNull<\/li>\n<\/ul>\n
Exception calling “ParseExact” with “3” argument(s): “String was not recognized as a valid DateTime.”
\nAt line:10 char:2<\/p>\n
\n- [DateTime]::ParseExact($raw.SubString(7,17), ‘yy-MM-dd HH:mm:ss’, $n …<\/li>\n
- \n
<\/code><\/pre>\n<\/li>\n- CategoryInfo : NotSpecified: (
<\/span>, MethodInvocationException<\/li>\n- FullyQualifiedErrorId : FormatException<\/li>\n<\/ul>\n
I’ve tried different time sources, changed the date format to dd-mm-yyyy but receive the same error. Any ideas?<\/p>\n
Kind Regards<\/p>\n
Rash<\/p>","upvoteCount":3,"answerCount":5,"datePublished":"2019-04-25T12:44:37.000Z","author":{"@type":"Person","name":"rashpaldhesi","url":"https://community.spiceworks.com/u/rashpaldhesi"},"suggestedAnswer":[{"@type":"Answer","text":"
Hi,<\/p>\n
We are trying to monitor time skew between our servers using SolarWinds, the out-of-the-box PowerShell script (attached) is giving the below error.<\/p>\n
Output: ==============================================
\nMessage: Try to rerrun script. Error: Exception calling “ParseExact” with “3” argument(s): “String was not recognized as a valid DateTime.”<\/p>\n
Errors: ==============================================
\nException calling “Connect” with “2” argument(s): “A connection attempt failed because the connected party did not properly respond after a period of time, or established connection failed because connected host has failed to respond 192.168.116.234:13”
\nAt line:5 char:2<\/p>\n
\n- $TcpClient.Connect($time_server, 13)<\/li>\n
- \n
<\/code><\/pre>\n<\/li>\n- CategoryInfo : NotSpecified: (
<\/span>, MethodInvocationException<\/li>\n- FullyQualifiedErrorId : SocketException<\/li>\n<\/ul>\n
Exception calling “GetStream” with “0” argument(s): “The operation is not allowed on non-connected sockets.”
\nAt line:6 char:2<\/p>\n
\n- $TcpStream = $TcpClient.GetStream()<\/li>\n
- \n
<\/code><\/pre>\n<\/li>\n- CategoryInfo : NotSpecified: (
<\/span>, MethodInvocationException<\/li>\n- FullyQualifiedErrorId : InvalidOperationException<\/li>\n<\/ul>\n
You cannot call a method on a null-valued expression.
\nAt line:7 char:2<\/p>\n
\n- $length = $TcpStream.Read($buffer, 0, $buffer.Length);<\/li>\n
- \n
<\/code><\/pre>\n<\/li>\n- CategoryInfo : InvalidOperation: (
<\/span>, RuntimeException<\/li>\n- FullyQualifiedErrorId : InvokeMethodOnNull<\/li>\n<\/ul>\n
Exception calling “ParseExact” with “3” argument(s): “String was not recognized as a valid DateTime.”
\nAt line:10 char:2<\/p>\n
\n- [DateTime]::ParseExact($raw.SubString(7,17), ‘yy-MM-dd HH:mm:ss’, $n …<\/li>\n
- \n
<\/code><\/pre>\n<\/li>\n- CategoryInfo : NotSpecified: (
<\/span>, MethodInvocationException<\/li>\n- FullyQualifiedErrorId : FormatException<\/li>\n<\/ul>\n
I’ve tried different time sources, changed the date format to dd-mm-yyyy but receive the same error. Any ideas?<\/p>\n
Kind Regards<\/p>\n
Rash<\/p>","upvoteCount":3,"datePublished":"2019-04-25T12:44:37.000Z","url":"https://community.spiceworks.com/t/time-monitoring-solarwinds/709089/1","author":{"@type":"Person","name":"rashpaldhesi","url":"https://community.spiceworks.com/u/rashpaldhesi"}},{"@type":"Answer","text":"