Need to validate the Azure Virtual machine username and password.
Now used the following code to validate the Virtual machine username and password.
$SecureVmPassword = ConvertTo-SecureString -string $VmPassword -AsPlainText -Force
$VmCredential = New-Object -typename System.Management.Automation.PSCredential -argumentlist $Fqdn"\"$VmUsername, $SecureVmPassword
Invoke-Command -ConnectionUri $RemoteConnectionUri.ToString() -Credential $VmCredential -ScriptBlock{
}
But cannot able to validate the Virtual machine credentials while Virtual machines are in shutdown state.
Is there any way to validate Virtual machine credentials even when the Virtual machines are in shutdown state?
There's none. You are trying to check credentials over an inactive remote object (a powered off VM). You will either need access to its local drive and SAM database (if it's a non-DC) or NTDS database (if DC), then parse that one in your active computing resources to check the supplied credentials. This is kind of ripping one's intestines out just to check if your food would digest in there. So, if the target VM is shut down, you need to skip credentials validation, or use domain credentials that are sure to be valid for that particular VM, but are able to be verified on some other resource (the domain's DC).
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With