<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: Last entry in VMKernel log in VMware PowerCLI Discussions</title>
    <link>https://communities.vmware.com/t5/VMware-PowerCLI-Discussions/Last-entry-in-VMKernel-log/m-p/2837836#M100597</link>
    <description>&lt;P&gt;Yes it is possible to&amp;nbsp;&lt;SPAN&gt;provide a list with hostnames and credentials however I would request if you can show me both SSH and Get-Log.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Wed, 24 Mar 2021 12:14:41 GMT</pubDate>
    <dc:creator>Pilu1978</dc:creator>
    <dc:date>2021-03-24T12:14:41Z</dc:date>
    <item>
      <title>Last entry in VMKernel log</title>
      <link>https://communities.vmware.com/t5/VMware-PowerCLI-Discussions/Last-entry-in-VMKernel-log/m-p/2837815#M100593</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;Recently we have come across&amp;nbsp;issue where we found that there are no new messages being logged in the vmkernel log on a VxRail host. Now Dell has advised us to scan all the vxrail hosts in the environment to find date and time of the last entry in the vmkernel log.&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;I know we can use the Get-Log cmdlet to get the vmkernel log entries however I am struggling to fetch the date and time of the last entry/message in the vmkernel.log.&lt;/P&gt;&lt;P&gt;Please help.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 24 Mar 2021 10:43:45 GMT</pubDate>
      <guid>https://communities.vmware.com/t5/VMware-PowerCLI-Discussions/Last-entry-in-VMKernel-log/m-p/2837815#M100593</guid>
      <dc:creator>Pilu1978</dc:creator>
      <dc:date>2021-03-24T10:43:45Z</dc:date>
    </item>
    <item>
      <title>Re: Last entry in VMKernel log</title>
      <link>https://communities.vmware.com/t5/VMware-PowerCLI-Discussions/Last-entry-in-VMKernel-log/m-p/2837826#M100594</link>
      <description>&lt;P&gt;Do you have SSH access to the ESXi nodes?&lt;/P&gt;</description>
      <pubDate>Wed, 24 Mar 2021 11:40:48 GMT</pubDate>
      <guid>https://communities.vmware.com/t5/VMware-PowerCLI-Discussions/Last-entry-in-VMKernel-log/m-p/2837826#M100594</guid>
      <dc:creator>LucD</dc:creator>
      <dc:date>2021-03-24T11:40:48Z</dc:date>
    </item>
    <item>
      <title>Re: Last entry in VMKernel log</title>
      <link>https://communities.vmware.com/t5/VMware-PowerCLI-Discussions/Last-entry-in-VMKernel-log/m-p/2837834#M100595</link>
      <description>&lt;P&gt;Yes but there is a challenge as each host has different password.&lt;/P&gt;</description>
      <pubDate>Wed, 24 Mar 2021 12:03:34 GMT</pubDate>
      <guid>https://communities.vmware.com/t5/VMware-PowerCLI-Discussions/Last-entry-in-VMKernel-log/m-p/2837834#M100595</guid>
      <dc:creator>Pilu1978</dc:creator>
      <dc:date>2021-03-24T12:03:34Z</dc:date>
    </item>
    <item>
      <title>Re: Last entry in VMKernel log</title>
      <link>https://communities.vmware.com/t5/VMware-PowerCLI-Discussions/Last-entry-in-VMKernel-log/m-p/2837835#M100596</link>
      <description>&lt;P&gt;Is there any way you can provide a list with hostnames and credentials?&lt;BR /&gt;Otherwise, it will have to be via Get-Log,&amp;nbsp; which will take quite a bit longer&lt;/P&gt;</description>
      <pubDate>Wed, 24 Mar 2021 12:09:36 GMT</pubDate>
      <guid>https://communities.vmware.com/t5/VMware-PowerCLI-Discussions/Last-entry-in-VMKernel-log/m-p/2837835#M100596</guid>
      <dc:creator>LucD</dc:creator>
      <dc:date>2021-03-24T12:09:36Z</dc:date>
    </item>
    <item>
      <title>Re: Last entry in VMKernel log</title>
      <link>https://communities.vmware.com/t5/VMware-PowerCLI-Discussions/Last-entry-in-VMKernel-log/m-p/2837836#M100597</link>
      <description>&lt;P&gt;Yes it is possible to&amp;nbsp;&lt;SPAN&gt;provide a list with hostnames and credentials however I would request if you can show me both SSH and Get-Log.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 24 Mar 2021 12:14:41 GMT</pubDate>
      <guid>https://communities.vmware.com/t5/VMware-PowerCLI-Discussions/Last-entry-in-VMKernel-log/m-p/2837836#M100597</guid>
      <dc:creator>Pilu1978</dc:creator>
      <dc:date>2021-03-24T12:14:41Z</dc:date>
    </item>
    <item>
      <title>Re: Last entry in VMKernel log</title>
      <link>https://communities.vmware.com/t5/VMware-PowerCLI-Discussions/Last-entry-in-VMKernel-log/m-p/2837839#M100599</link>
      <description>&lt;P&gt;This is the Get-Log based one&lt;/P&gt;
&lt;LI-CODE lang="csharp"&gt;Get-VMHost -PipelineVariable esx |
ForEach-Object -Process {
    Get-Log -Key vmkernel -VMHost $esx |
    Select @{N='VMHost';E={$_.Host.Name}},
        @{N='LastLine';E={$_.Entries[$_.LastLineNum - 1]}}
}&lt;/LI-CODE&gt;</description>
      <pubDate>Wed, 24 Mar 2021 12:25:41 GMT</pubDate>
      <guid>https://communities.vmware.com/t5/VMware-PowerCLI-Discussions/Last-entry-in-VMKernel-log/m-p/2837839#M100599</guid>
      <dc:creator>LucD</dc:creator>
      <dc:date>2021-03-24T12:25:41Z</dc:date>
    </item>
    <item>
      <title>Re: Last entry in VMKernel log</title>
      <link>https://communities.vmware.com/t5/VMware-PowerCLI-Discussions/Last-entry-in-VMKernel-log/m-p/2837849#M100603</link>
      <description>&lt;P&gt;Thanks LucD. Much appreciated. It is working like a charm.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 24 Mar 2021 12:52:25 GMT</pubDate>
      <guid>https://communities.vmware.com/t5/VMware-PowerCLI-Discussions/Last-entry-in-VMKernel-log/m-p/2837849#M100603</guid>
      <dc:creator>Pilu1978</dc:creator>
      <dc:date>2021-03-24T12:52:25Z</dc:date>
    </item>
    <item>
      <title>Re: Last entry in VMKernel log</title>
      <link>https://communities.vmware.com/t5/VMware-PowerCLI-Discussions/Last-entry-in-VMKernel-log/m-p/2968492#M111952</link>
      <description>&lt;P&gt;Hi,&amp;nbsp;&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;&lt;P&gt;I need further help on this so posting my query here.&lt;/P&gt;&lt;P&gt;I am trying to fetch Date and time from this last entry of host vmkrnel log like below but I am getting the exception mentioned below. Please let me know how can I convert it to Date and Time format so that I can find out the time difference with the current date and time.&lt;/P&gt;&lt;P&gt;$lastLine = Get-Log -Key vmkernel -VMHost $esx | Select @{N='VMHost';E={$_.Host.Name}},@{N='LastLine';E={$_.Entries[$_.LastLineNum - 1]}}&lt;/P&gt;&lt;P&gt;$lastDateTime = $lastLine.LastLine.Split("Z ")[0].ToDateTime($_)&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Exception calling "ToDateTime" with "1" argument(s): "String was not recognized as a valid DateTime."&lt;BR /&gt;At D:\PNF-Morning-Checks\VSAN-MorningCheck-Daily.ps1:761 char:6&lt;BR /&gt;+ ... $lastTime = $lastLine.LastLine.Split("Z ")[0].ToDateTime( ...&lt;BR /&gt;+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~&lt;BR /&gt;+ CategoryInfo : NotSpecified: (:) [], MethodInvocationException&lt;BR /&gt;+ FullyQualifiedErrorId : FormatException&lt;/P&gt;</description>
      <pubDate>Mon, 15 May 2023 13:10:22 GMT</pubDate>
      <guid>https://communities.vmware.com/t5/VMware-PowerCLI-Discussions/Last-entry-in-VMKernel-log/m-p/2968492#M111952</guid>
      <dc:creator>Pilu1978</dc:creator>
      <dc:date>2023-05-15T13:10:22Z</dc:date>
    </item>
    <item>
      <title>Re: Last entry in VMKernel log</title>
      <link>https://communities.vmware.com/t5/VMware-PowerCLI-Discussions/Last-entry-in-VMKernel-log/m-p/2968543#M111962</link>
      <description>&lt;P&gt;Not sure what you have in $lastLine.LastLine, but assuming it is the last line fo the vmkernel log, can you try casting with DateTime?&lt;BR /&gt;You do not have to drop the 'Z' at the end, rather split on the blank.&lt;/P&gt;
&lt;LI-CODE lang="csharp"&gt;$lastDateTime = [DateTime]($lastLine.LastLine.Split(' ')[0])&lt;/LI-CODE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 15 May 2023 15:02:30 GMT</pubDate>
      <guid>https://communities.vmware.com/t5/VMware-PowerCLI-Discussions/Last-entry-in-VMKernel-log/m-p/2968543#M111962</guid>
      <dc:creator>LucD</dc:creator>
      <dc:date>2023-05-15T15:02:30Z</dc:date>
    </item>
    <item>
      <title>Re: Last entry in VMKernel log</title>
      <link>https://communities.vmware.com/t5/VMware-PowerCLI-Discussions/Last-entry-in-VMKernel-log/m-p/2968553#M111963</link>
      <description>&lt;P&gt;Thanks Lucd for your reply.&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;$lastLine.LastLine is giving the last entry of the vmkernel log like below:&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;2023-05-15T04:47:37.814Z cpu40:16672)WARNING: LinScsi: SCSILinuxAbortCommands:1816:Failed, Driver hpsa, for vmhba0&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;I have tried as you advised but getting the following error:&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;Cannot convert value "" to type "System.DateTime". Error: "String was not recognized as a valid DateTime."&lt;BR /&gt;At D:\PNF-Morning-Checks\VSAN-MorningCheck-Daily.ps1:761 char:6&lt;BR /&gt;+ ... $lastDateTime = [DateTime]($lastLine.LastLine.Split(' ')[ ...&lt;BR /&gt;+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~&lt;BR /&gt;+ CategoryInfo : InvalidArgument: (:) [], RuntimeException&lt;BR /&gt;+ FullyQualifiedErrorId : InvalidCastParseTargetInvocationWithFormatProvider&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Mon, 15 May 2023 16:02:41 GMT</pubDate>
      <guid>https://communities.vmware.com/t5/VMware-PowerCLI-Discussions/Last-entry-in-VMKernel-log/m-p/2968553#M111963</guid>
      <dc:creator>Pilu1978</dc:creator>
      <dc:date>2023-05-15T16:02:41Z</dc:date>
    </item>
    <item>
      <title>Re: Last entry in VMKernel log</title>
      <link>https://communities.vmware.com/t5/VMware-PowerCLI-Discussions/Last-entry-in-VMKernel-log/m-p/2968560#M111964</link>
      <description>&lt;P&gt;Seems to work for me&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="LucD_0-1684167601170.png" style="width: 400px;"&gt;&lt;img src="https://communities.vmware.com/t5/image/serverpage/image-id/101548iE880C293E34A6F8E/image-size/medium?v=v2&amp;amp;px=400" role="button" title="LucD_0-1684167601170.png" alt="LucD_0-1684167601170.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;Do you have a String in $lastLine.LastLine or output from a Select-Object cmdlet?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 15 May 2023 16:20:41 GMT</pubDate>
      <guid>https://communities.vmware.com/t5/VMware-PowerCLI-Discussions/Last-entry-in-VMKernel-log/m-p/2968560#M111964</guid>
      <dc:creator>LucD</dc:creator>
      <dc:date>2023-05-15T16:20:41Z</dc:date>
    </item>
    <item>
      <title>Re: Last entry in VMKernel log</title>
      <link>https://communities.vmware.com/t5/VMware-PowerCLI-Discussions/Last-entry-in-VMKernel-log/m-p/2968567#M111965</link>
      <description>&lt;P&gt;It is the output of the following command&lt;/P&gt;&lt;P&gt;$lastLine = Get-Log -Key vmkernel -VMHost $esx | Select @{N='VMHost';E={$_.Host.Name}},@{N='LastLine';E={$_.Entries[$_.LastLineNum - 1]}}&lt;/P&gt;</description>
      <pubDate>Mon, 15 May 2023 16:40:28 GMT</pubDate>
      <guid>https://communities.vmware.com/t5/VMware-PowerCLI-Discussions/Last-entry-in-VMKernel-log/m-p/2968567#M111965</guid>
      <dc:creator>Pilu1978</dc:creator>
      <dc:date>2023-05-15T16:40:28Z</dc:date>
    </item>
    <item>
      <title>Re: Last entry in VMKernel log</title>
      <link>https://communities.vmware.com/t5/VMware-PowerCLI-Discussions/Last-entry-in-VMKernel-log/m-p/2968580#M111966</link>
      <description>&lt;P&gt;That is exactly what I just did, and it works for me.&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="LucD_0-1684169816875.png" style="width: 400px;"&gt;&lt;img src="https://communities.vmware.com/t5/image/serverpage/image-id/101549i70A12E8BFEA6C790/image-size/medium?v=v2&amp;amp;px=400" role="button" title="LucD_0-1684169816875.png" alt="LucD_0-1684169816875.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;It could be that your station has regional settings that are not en-US.&lt;BR /&gt;And unfortunately, the DateTime casting uses the en-US setting by default.&lt;BR /&gt;What does the following return?&lt;/P&gt;
&lt;LI-CODE lang="csharp"&gt;Get-Culture&lt;/LI-CODE&gt;
&lt;P&gt;If that is not en-US, you can force the DateTime conversion to use en-US (as the VMKernel log uses)&lt;/P&gt;
&lt;LI-CODE lang="csharp"&gt;$c = [cultureInfo]::GetCultureInfo('en-US')
$lastLine.LastLine.Split(' ')[0].ToDateTime($c) &lt;/LI-CODE&gt;</description>
      <pubDate>Mon, 15 May 2023 17:13:19 GMT</pubDate>
      <guid>https://communities.vmware.com/t5/VMware-PowerCLI-Discussions/Last-entry-in-VMKernel-log/m-p/2968580#M111966</guid>
      <dc:creator>LucD</dc:creator>
      <dc:date>2023-05-15T17:13:19Z</dc:date>
    </item>
    <item>
      <title>Re: Last entry in VMKernel log</title>
      <link>https://communities.vmware.com/t5/VMware-PowerCLI-Discussions/Last-entry-in-VMKernel-log/m-p/2968587#M111967</link>
      <description>&lt;P&gt;Hi LucD,&lt;/P&gt;&lt;P&gt;You are just awesome.&lt;/P&gt;&lt;P&gt;Yes the server is using the regional setting as en-GB.&lt;/P&gt;</description>
      <pubDate>Mon, 15 May 2023 17:41:11 GMT</pubDate>
      <guid>https://communities.vmware.com/t5/VMware-PowerCLI-Discussions/Last-entry-in-VMKernel-log/m-p/2968587#M111967</guid>
      <dc:creator>Pilu1978</dc:creator>
      <dc:date>2023-05-15T17:41:11Z</dc:date>
    </item>
  </channel>
</rss>

