Hi there,
i don't know the possibility in doing this directly from powershell. One way is to use plink.
function set-hostrootlogin([string]$esxentry){
$str1=’c:\plink.exe -v -pw ”v53HYfsd#$%$%^^&*” -l root ‘
$str2=’ sed -i "s/PermitRootLogin no/PermitRootLogin yes/g" /etc/ssh/sshd_config’
$esxhost=”‘”+$esxentry+”‘”
$command=$str1+$esxhost+$str2
$esxentry.name >> $outfile
Invoke-Expression -Command $command
}
assuming you have plink.exe in c:\ and password of -pw ”v53HYfsd#$%$%^^&*” :smileywink:
This should work., You can make a powershell function which is more customizable from this if you need.
set-hostrootlogin "yourhost.yourdomain.local"
:smileywink:
Regards,
Greg