<?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: SLPD service - Show a list of host and if the service is on or off in VMware PowerCLI Discussions</title>
    <link>https://communities.vmware.com/t5/VMware-PowerCLI-Discussions/SLPD-service-Show-a-list-of-host-and-if-the-service-is-on-or-off/m-p/2953253#M110674</link>
    <description>&lt;P&gt;Looks like the SSH session (New-SSHSession)&amp;nbsp;was not established.&lt;/P&gt;</description>
    <pubDate>Wed, 08 Feb 2023 11:13:49 GMT</pubDate>
    <dc:creator>LucD</dc:creator>
    <dc:date>2023-02-08T11:13:49Z</dc:date>
    <item>
      <title>SLPD service - Show a list of host and if the service is on or off</title>
      <link>https://communities.vmware.com/t5/VMware-PowerCLI-Discussions/SLPD-service-Show-a-list-of-host-and-if-the-service-is-on-or-off/m-p/2952913#M110624</link>
      <description>&lt;P&gt;Hi LUCD&lt;/P&gt;&lt;P&gt;I am trying to find a script which will show the&amp;nbsp;chkconfig --list | grep slpd for each host in my vcenter. I have 130 hosts and at the moment I can only do this by logging onto each host which is time consuming.&lt;/P&gt;&lt;P&gt;Please help&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks&lt;/P&gt;&lt;P&gt;Mo&lt;/P&gt;</description>
      <pubDate>Mon, 06 Feb 2023 20:38:11 GMT</pubDate>
      <guid>https://communities.vmware.com/t5/VMware-PowerCLI-Discussions/SLPD-service-Show-a-list-of-host-and-if-the-service-is-on-or-off/m-p/2952913#M110624</guid>
      <dc:creator>mbabu1</dc:creator>
      <dc:date>2023-02-06T20:38:11Z</dc:date>
    </item>
    <item>
      <title>Re: SLPD service - Show a list of host and if the service is on or off</title>
      <link>https://communities.vmware.com/t5/VMware-PowerCLI-Discussions/SLPD-service-Show-a-list-of-host-and-if-the-service-is-on-or-off/m-p/2952918#M110626</link>
      <description>&lt;P&gt;Have a look at&amp;nbsp;&lt;A href="https://communities.vmware.com/t5/VMware-PowerCLI-Discussions/PowerCLI-Workaround-for-OpenSLP-security-vulnerability-in-ESXi-6/m-p/1860612/highlight/true#M63517" target="_blank"&gt;Re: PowerCLI - Workaround for OpenSLP security vul... - VMware Technology Network VMTN&lt;/A&gt;&lt;/P&gt;</description>
      <pubDate>Mon, 06 Feb 2023 21:00:05 GMT</pubDate>
      <guid>https://communities.vmware.com/t5/VMware-PowerCLI-Discussions/SLPD-service-Show-a-list-of-host-and-if-the-service-is-on-or-off/m-p/2952918#M110626</guid>
      <dc:creator>LucD</dc:creator>
      <dc:date>2023-02-06T21:00:05Z</dc:date>
    </item>
    <item>
      <title>Re: SLPD service - Show a list of host and if the service is on or off</title>
      <link>https://communities.vmware.com/t5/VMware-PowerCLI-Discussions/SLPD-service-Show-a-list-of-host-and-if-the-service-is-on-or-off/m-p/2953010#M110637</link>
      <description>&lt;P&gt;Thank you LucD,&lt;/P&gt;&lt;P&gt;I have gone through the above link and the scripts actually carry out the fix. All I want is an output to show a list of all my hosts in the vCenter with the slpd service name and if its on or off. I can only run the chkconfig --list | grep slpd at host level, like to run this on all hosts at once have an output on csv.&lt;/P&gt;&lt;P&gt;I hope that helps and thanks for your help in advance.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 07 Feb 2023 08:51:53 GMT</pubDate>
      <guid>https://communities.vmware.com/t5/VMware-PowerCLI-Discussions/SLPD-service-Show-a-list-of-host-and-if-the-service-is-on-or-off/m-p/2953010#M110637</guid>
      <dc:creator>mbabu1</dc:creator>
      <dc:date>2023-02-07T08:51:53Z</dc:date>
    </item>
    <item>
      <title>Re: SLPD service - Show a list of host and if the service is on or off</title>
      <link>https://communities.vmware.com/t5/VMware-PowerCLI-Discussions/SLPD-service-Show-a-list-of-host-and-if-the-service-is-on-or-off/m-p/2953016#M110638</link>
      <description>&lt;P&gt;Ok, I see.&lt;BR /&gt;The following will only list the status of the SLPD service on all ESXi nodes.&lt;BR /&gt;&lt;BR /&gt;Note, the code does assume that the root credentials on all ESXi nodes are the same&lt;/P&gt;
&lt;LI-CODE lang="csharp"&gt;$user = 'root'
$pswd = 'VMware1!'

$cmdsub = @'
chkconfig --list | grep slpd;
'@

$secPswd = ConvertTo-SecureString -String $pswd -AsPlainText -Force
$cred = New-Object System.Management.Automation.PSCredential ($user, $secPswd)

Get-VMHost -PipelineVariable esx |
ForEach-Object -Process {
    Get-VMHostService -VMHost $esx | Where-Object { $_.Key -eq 'TSM-SSH' } | Start-VMHostService -Confirm:$false | Out-Null

    $session = New-SSHSession -ComputerName $esx.Name -Credential $cred -AcceptKey
    Invoke-SSHCommand -SSHSession $session -Command $cmdSub |
    Select-Object @{N = 'VMHost'; E = { $esx.Name } }, @{N = 'SLPD'; E = { $_.Output } }
    Remove-SSHSession -SSHSession $session | Out-Null

    Get-VMHostService -VMHost $esx | Where-Object { $_.Key -eq 'TSM-SSH' } | Stop-VMHostService -Confirm:$false | Out-Null
}
&lt;/LI-CODE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 07 Feb 2023 09:14:39 GMT</pubDate>
      <guid>https://communities.vmware.com/t5/VMware-PowerCLI-Discussions/SLPD-service-Show-a-list-of-host-and-if-the-service-is-on-or-off/m-p/2953016#M110638</guid>
      <dc:creator>LucD</dc:creator>
      <dc:date>2023-02-07T09:14:39Z</dc:date>
    </item>
    <item>
      <title>Re: SLPD service - Show a list of host and if the service is on or off</title>
      <link>https://communities.vmware.com/t5/VMware-PowerCLI-Discussions/SLPD-service-Show-a-list-of-host-and-if-the-service-is-on-or-off/m-p/2953065#M110639</link>
      <description>&lt;P&gt;AMAZING.....you are a LEGEND...! Worked like a dream&lt;/P&gt;</description>
      <pubDate>Tue, 07 Feb 2023 14:20:44 GMT</pubDate>
      <guid>https://communities.vmware.com/t5/VMware-PowerCLI-Discussions/SLPD-service-Show-a-list-of-host-and-if-the-service-is-on-or-off/m-p/2953065#M110639</guid>
      <dc:creator>mbabu1</dc:creator>
      <dc:date>2023-02-07T14:20:44Z</dc:date>
    </item>
    <item>
      <title>Re: SLPD service - Show a list of host and if the service is on or off</title>
      <link>https://communities.vmware.com/t5/VMware-PowerCLI-Discussions/SLPD-service-Show-a-list-of-host-and-if-the-service-is-on-or-off/m-p/2953069#M110640</link>
      <description>&lt;P&gt;I tested the above script in my lab. There are 3 esxi hosts in my lab and SLPD service stopped for 2 hosts and running on 1 host. However, the output showing SLPD off only.&lt;BR /&gt;&lt;BR /&gt;I've attached a screenshot for the host where SLPD running. Could you please have a look.&lt;/P&gt;</description>
      <pubDate>Tue, 07 Feb 2023 14:39:07 GMT</pubDate>
      <guid>https://communities.vmware.com/t5/VMware-PowerCLI-Discussions/SLPD-service-Show-a-list-of-host-and-if-the-service-is-on-or-off/m-p/2953069#M110640</guid>
      <dc:creator>mvattigunta</dc:creator>
      <dc:date>2023-02-07T14:39:07Z</dc:date>
    </item>
    <item>
      <title>Re: SLPD service - Show a list of host and if the service is on or off</title>
      <link>https://communities.vmware.com/t5/VMware-PowerCLI-Discussions/SLPD-service-Show-a-list-of-host-and-if-the-service-is-on-or-off/m-p/2953078#M110643</link>
      <description>&lt;P&gt;What I think happened is the following.&lt;BR /&gt;The &lt;STRONG&gt;chkconfig --list&lt;/STRONG&gt; command shows the persistent status of the service.&lt;BR /&gt;The &lt;STRONG&gt;/etc/init.d/slpd&lt;/STRONG&gt; status shows the current status.&lt;BR /&gt;&lt;BR /&gt;The code should in fact list the 2 options, current status and the persistent config.&lt;/P&gt;
&lt;P&gt;Something like this&lt;/P&gt;
&lt;LI-CODE lang="csharp"&gt;$user = 'root'
$pswd = 'VMware1!'

$cmdsub1 = @'
/etc/init.d/slpd status;
'@
$cmdsub2 = @'
chkconfig --list | grep slpd;
'@

$secPswd = ConvertTo-SecureString -String $pswd -AsPlainText -Force
$cred = New-Object System.Management.Automation.PSCredential ($user, $secPswd)

Get-VMHost -PipelineVariable esx |
ForEach-Object -Process {
    Get-VMHostService -VMHost $esx | Where-Object { $_.Key -eq 'TSM-SSH' } | Start-VMHostService -Confirm:$false | Out-Null

    $session = New-SSHSession -ComputerName $esx.Name -Credential $cred -AcceptKey

    $current = Invoke-SSHCommand -SSHSession $session -Command $cmdSub1
    $persistent = Invoke-SSHCommand -SSHSession $session -Command $cmdSub2
    New-Object -TypeName PSObject -Property ([ordered]@{
        VMHost = $esx.Name
        Current = $current.Output[0]
        Persistent = $persistent.Output[0]
    })

    Remove-SSHSession -SSHSession $session | Out-Null

    Get-VMHostService -VMHost $esx | Where-Object { $_.Key -eq 'TSM-SSH' } | Stop-VMHostService -Confirm:$false | Out-Null
}&lt;/LI-CODE&gt;
&lt;P&gt;To stop the service and change the persistent setting, the original thread I pointed to does that&lt;/P&gt;</description>
      <pubDate>Tue, 07 Feb 2023 15:43:00 GMT</pubDate>
      <guid>https://communities.vmware.com/t5/VMware-PowerCLI-Discussions/SLPD-service-Show-a-list-of-host-and-if-the-service-is-on-or-off/m-p/2953078#M110643</guid>
      <dc:creator>LucD</dc:creator>
      <dc:date>2023-02-07T15:43:00Z</dc:date>
    </item>
    <item>
      <title>Re: SLPD service - Show a list of host and if the service is on or off</title>
      <link>https://communities.vmware.com/t5/VMware-PowerCLI-Discussions/SLPD-service-Show-a-list-of-host-and-if-the-service-is-on-or-off/m-p/2953087#M110646</link>
      <description>&lt;P&gt;Excellent LucD. Both checks (persistent and current status) providing the result now. Appreciate your support.&lt;/P&gt;</description>
      <pubDate>Tue, 07 Feb 2023 16:24:05 GMT</pubDate>
      <guid>https://communities.vmware.com/t5/VMware-PowerCLI-Discussions/SLPD-service-Show-a-list-of-host-and-if-the-service-is-on-or-off/m-p/2953087#M110646</guid>
      <dc:creator>mvattigunta</dc:creator>
      <dc:date>2023-02-07T16:24:05Z</dc:date>
    </item>
    <item>
      <title>Re: SLPD service - Show a list of host and if the service is on or off</title>
      <link>https://communities.vmware.com/t5/VMware-PowerCLI-Discussions/SLPD-service-Show-a-list-of-host-and-if-the-service-is-on-or-off/m-p/2953251#M110673</link>
      <description>&lt;P&gt;Hi Lucd,&lt;/P&gt;&lt;P&gt;Thanks for reply, But when i run above script..I get error attached.&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Kumar.&lt;/P&gt;</description>
      <pubDate>Wed, 08 Feb 2023 11:08:19 GMT</pubDate>
      <guid>https://communities.vmware.com/t5/VMware-PowerCLI-Discussions/SLPD-service-Show-a-list-of-host-and-if-the-service-is-on-or-off/m-p/2953251#M110673</guid>
      <dc:creator>prasanna22kumar</dc:creator>
      <dc:date>2023-02-08T11:08:19Z</dc:date>
    </item>
    <item>
      <title>Re: SLPD service - Show a list of host and if the service is on or off</title>
      <link>https://communities.vmware.com/t5/VMware-PowerCLI-Discussions/SLPD-service-Show-a-list-of-host-and-if-the-service-is-on-or-off/m-p/2953253#M110674</link>
      <description>&lt;P&gt;Looks like the SSH session (New-SSHSession)&amp;nbsp;was not established.&lt;/P&gt;</description>
      <pubDate>Wed, 08 Feb 2023 11:13:49 GMT</pubDate>
      <guid>https://communities.vmware.com/t5/VMware-PowerCLI-Discussions/SLPD-service-Show-a-list-of-host-and-if-the-service-is-on-or-off/m-p/2953253#M110674</guid>
      <dc:creator>LucD</dc:creator>
      <dc:date>2023-02-08T11:13:49Z</dc:date>
    </item>
    <item>
      <title>Re: SLPD service - Show a list of host and if the service is on or off</title>
      <link>https://communities.vmware.com/t5/VMware-PowerCLI-Discussions/SLPD-service-Show-a-list-of-host-and-if-the-service-is-on-or-off/m-p/2953255#M110675</link>
      <description>&lt;P&gt;HI Lucd,&lt;/P&gt;&lt;P&gt;If i manually enable SSH and run the below script to verify the SLP status, SSH gets disabled. So it's not able open new SSH session&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;$cmdsub1 = @'&lt;BR /&gt;/etc/init.d/slpd status;&lt;BR /&gt;'@&lt;BR /&gt;$cmdsub2 = @'&lt;BR /&gt;chkconfig --list | grep slpd;&lt;BR /&gt;'@&lt;/P&gt;&lt;P&gt;$secPswd = ConvertTo-SecureString -String $pswd -AsPlainText -Force&lt;BR /&gt;$cred = New-Object System.Management.Automation.PSCredential ($user, $secPswd)&lt;/P&gt;&lt;P&gt;Get-VMHost -PipelineVariable esx |&lt;BR /&gt;ForEach-Object -Process {&lt;BR /&gt;Get-VMHostService -VMHost $esx | Where-Object { $_.Key -eq 'TSM-SSH' } | Start-VMHostService -Confirm:$false | Out-Null&lt;/P&gt;&lt;P&gt;$session = New-SSHSession -ComputerName $esx.Name -Credential $cred -AcceptKey&lt;/P&gt;&lt;P&gt;$current = Invoke-SSHCommand -SSHSession $session -Command $cmdSub1&lt;BR /&gt;$persistent = Invoke-SSHCommand -SSHSession $session -Command $cmdSub2&lt;BR /&gt;New-Object -TypeName PSObject -Property ([ordered]@{&lt;BR /&gt;VMHost = $esx.Name&lt;BR /&gt;Current = $current.Output[0]&lt;BR /&gt;Persistent = $persistent.Output[0]&lt;BR /&gt;})&lt;/P&gt;&lt;P&gt;Remove-SSHSession -SSHSession $session | Out-Null&lt;/P&gt;&lt;P&gt;Get-VMHostService -VMHost $esx | Where-Object { $_.Key -eq 'TSM-SSH' } | Stop-VMHostService -Confirm:$false | Out-Null&lt;BR /&gt;}&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Kumar&lt;/P&gt;</description>
      <pubDate>Wed, 08 Feb 2023 11:21:26 GMT</pubDate>
      <guid>https://communities.vmware.com/t5/VMware-PowerCLI-Discussions/SLPD-service-Show-a-list-of-host-and-if-the-service-is-on-or-off/m-p/2953255#M110675</guid>
      <dc:creator>prasanna22kumar</dc:creator>
      <dc:date>2023-02-08T11:21:26Z</dc:date>
    </item>
    <item>
      <title>Re: SLPD service - Show a list of host and if the service is on or off</title>
      <link>https://communities.vmware.com/t5/VMware-PowerCLI-Discussions/SLPD-service-Show-a-list-of-host-and-if-the-service-is-on-or-off/m-p/2953261#M110677</link>
      <description>&lt;P&gt;That code disables the SSH service at the end.&lt;BR /&gt;But does New-SshSession actually work?&lt;BR /&gt;What is returned when you do&lt;/P&gt;
&lt;LI-CODE lang="csharp"&gt;New-SSHSession -ComputerName MyEsx -Credential $cred -AcceptKey -Verbose&lt;/LI-CODE&gt;
&lt;P&gt;&lt;BR /&gt;Does the ESXi firewall allow SSH traffic?&lt;BR /&gt;Check with&lt;/P&gt;
&lt;LI-CODE lang="csharp"&gt;Get-VMHostFireWallException -VMhost MyEsx -Name 'SSH *'&lt;/LI-CODE&gt;
&lt;P&gt;Is the SSH session timeout set too short?&lt;BR /&gt;Check with&lt;/P&gt;
&lt;LI-CODE lang="csharp"&gt;Get-AdvancedSetting -Entity MyEsx -Name 'UserVars.ESXiShellTimeOut' &lt;/LI-CODE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 08 Feb 2023 11:54:48 GMT</pubDate>
      <guid>https://communities.vmware.com/t5/VMware-PowerCLI-Discussions/SLPD-service-Show-a-list-of-host-and-if-the-service-is-on-or-off/m-p/2953261#M110677</guid>
      <dc:creator>LucD</dc:creator>
      <dc:date>2023-02-08T11:54:48Z</dc:date>
    </item>
  </channel>
</rss>

