Change Linux User password using Powershell

Sounds strange but yes it is possible šŸ™‚ Just one module and some lines of Powershell code and thats it.

Import-Module SSH-Sessions

$old_passwd = "vmware"
$new_passwd = "VMware1!"

New-SshSession -ComputerName IP-ADDRESS -Username admin -Password $old_passwd

$result = Invoke-SshCommand -ComputerName IP-ADDRESS -Command "printf '%s\n' $old_passwd $new_passwd $new_passwd | passwd"

Write-Host $result

Remove-SshSession -RemoveAll

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.