Issue Discription:
================
Workaround:
===========
Need to stop smartd daemon service on ESXi 6.0 host
You will need to use the plink.exe command from the PuTTY Suite
The script will check if the SSH service is running, if not, it will start it, and also stop it after the smartd service has been stopped.
.
Something like this
$user = <user>
$pswd = <password>
$plink = "<PuTTY dir>\plink.exe"
$plinkoptions = " -batch -pw $pswd"
$cmd = 'etc/init.d/smartd stop'
$remoteCommand = '"' + $cmd + '"'
Get-VMHost | %{
$ssh =Get-VMHostService -VMHost $_ | where{$_.Key -eq 'TSM-SSH'}
if(!$ssh.Running){
Start-VMHostService -HostService $ssh -Confirm:$false > $null
}
$command = $plink + " " + $plinkoptions + " " + $User + "@" + $_.Name + " " + $remoteCommand
Invoke-Expression -command $command
if(!$ssh.Running){
Stop-VMHostService -HostService $ssh -Confirm:$false > $null
}
}
Blog: lucd.info Twitter: @LucD22 Co-author PowerCLI Reference
You will need to use the plink.exe command from the PuTTY Suite
The script will check if the SSH service is running, if not, it will start it, and also stop it after the smartd service has been stopped.
.
Something like this
$user = <user>
$pswd = <password>
$plink = "<PuTTY dir>\plink.exe"
$plinkoptions = " -batch -pw $pswd"
$cmd = 'etc/init.d/smartd stop'
$remoteCommand = '"' + $cmd + '"'
Get-VMHost | %{
$ssh =Get-VMHostService -VMHost $_ | where{$_.Key -eq 'TSM-SSH'}
if(!$ssh.Running){
Start-VMHostService -HostService $ssh -Confirm:$false > $null
}
$command = $plink + " " + $plinkoptions + " " + $User + "@" + $_.Name + " " + $remoteCommand
Invoke-Expression -command $command
if(!$ssh.Running){
Stop-VMHostService -HostService $ssh -Confirm:$false > $null
}
}
Blog: lucd.info Twitter: @LucD22 Co-author PowerCLI Reference
thanks a lot Luc for prompt respons. I'll execute below script and let u know the status.
POst this change wanna pull the host report in orderto make sure that Smartd service status should be in stop. Could u pls help on this as well.
Thanks in Advance!!!
Best Regards,
SWamy Naveen.
The smartd service is not included in the ones returned by Get-VMHostService, so you will have to use the plink.exe again.
Replace the command by
$cmd = 'etc/init.d/smartd status'
Blog: lucd.info Twitter: @LucD22 Co-author PowerCLI Reference
Here's a script that logs in to your hosts in the specified cluster, disabled the smartd service and stops the service from starting again on next reboot (as per ESXi 6.0 host is disconnected from vCenter Server (2145106) | VMware KB)
Loosely based on LucD's script:
$user = 'yourlogin'
$pswd = 'yourpassword'$cmd = 'etc/init.d/smartd stop'
$cmd2 = 'chkconfig smartd off'Get-Cluster -Name yourclustername | Get-VMHost | %{
$ssh =Get-VMHostService -VMHost $_ | where{$_.Key -eq 'TSM-SSH'}
if(!$ssh.Running){
Start-VMHostService -HostService $ssh -Confirm:$false > $null
}Write-host "Running remote SSH commands on $($_.Name)." -ForegroundColor Yellow
Echo Y | ./plink.exe $_.Name -pw $pswd -l $user $cmd
Echo Y | ./plink.exe $_.Name -pw $pswd -l $user $cmd2if(!$ssh.Running){
Stop-VMHostService -HostService $ssh -Confirm:$false > $null
}
}