Hi,
This is what i see under /var/log/secure
Oct 7 14:39:51 nocrhevm01 vmtoolsd: PAM unable to dlopen(/lib64/security/pam_unix2.so): /lib64/security/pam_unix2.so: cannot open shared object file: No such file or directory
Oct 7 14:39:51 nocrhevm01 vmtoolsd: PAM adding faulty module: /lib64/security/pam_unix2.so
Oct 7 14:39:51 nocrhevm01 vmtoolsd: PAM unable to dlopen(/lib64/security/pam_unix2.so): /lib64/security/pam_unix2.so: cannot open shared object file: No such file or directory
Oct 7 14:39:51 nocrhevm01 vmtoolsd: PAM adding faulty module: /lib64/security/pam_unix2.so
Oct 7 14:39:51 nocrhevm01 passwd: pam_unix(passwd:chauthtok): password changed for root
Oct 7 14:39:51 nocrhevm01 vmtoolsd: PAM unable to dlopen(/lib64/security/pam_unix2.so): /lib64/security/pam_unix2.so: cannot open shared object file: No such file or directory
Oct 7 14:39:51 nocrhevm01 vmtoolsd: PAM adding faulty module: /lib64/security/pam_unix2.so
Oct 7 14:39:51 nocrhevm01 vmtoolsd: pam_unix(vmtoolsd:auth): authentication failure; logname= uid=0 euid=0 tty= ruser= rhost= user=root
Oct 7 14:39:53 nocrhevm01 vmtoolsd: PAM 1 more authentication failure; logname= uid=0 euid=0 tty= ruser= rhost= user=root
Oct 7 14:39:53 nocrhevm01 vmtoolsd: PAM unable to dlopen(/lib64/security/pam_unix2.so): /lib64/security/pam_unix2.so: cannot open shared object file: No such file or directory
Oct 7 14:39:53 nocrhevm01 vmtoolsd: PAM adding faulty module: /lib64/security/pam_unix2.so
Oct 7 14:39:53 nocrhevm01 vmtoolsd: pam_unix(vmtoolsd:auth): authentication failure; logname= uid=0 euid=0 tty= ruser= rhost= user=root
Oct 7 14:39:56 nocrhevm01 vmtoolsd: PAM 1 more authentication failure; logname= uid=0 euid=0 tty= ruser= rhost= user=root
and below is my script
Function Update-WindowsVM{
param($virtualmachine)
$vm = Get-VM NOCRHEVM01
$os = (Get-VM $vm | Get-View).Summary.Config.GuestFullName
$toolsStatus = (Get-VM $vm | Get-View).Guest.ToolsStatus
if($vm.powerstate -eq "PoweredOn"){
if($toolsStatus -eq "toolsOk"){
# Determining Windows
if($os -match 'Windows'){
Write-Host "Windows guest found" -fore Green
$update = "ipconfig"
}
elseif($os -match 'Linux'){
Write-Host "Linux guest found" -fore Blue
$update = "echo 'Password123' | passwd root --stdin"
}
else{Write-Host "could not identify guest OS" -fore Red}
# Update command
Write-Host "Running $update command" -fore Yellow
Invoke-VMScript -VM $vm -ScriptText $update -GuestUser root -GuestPassword oldpassword123 -scripttype bash
}
else{Write-Host $vm "VMware Tools are out off date or not running" -fore Red }
}
else{Write-Host $vm "is not running" -fore Red }
}
Update-WindowsVM