Add-Type -AssemblyName System.DirectoryServices.AccountManagement $account = New-Object System.DirectoryServices.AccountManagement.PrincipalContext([System.DirectoryServices.AccountManagement.ContextType]::Machine, $env:userdomain) # Nombre de usuario $user = Read-Host -Prompt "Introduzca usuario" # Crear password de tipo SecureString $SecurePassword = Read-Host -Prompt "Introduzca password" -AsSecureString # Extraer password de tipo SecureString $BSTR = [System.Runtime.InteropServices.Marshal]::SecureStringToBSTR($SecurePassword) $PlainPassword = [System.Runtime.InteropServices.Marshal]::PtrToStringAuto($BSTR) $account.ValidateCredentials($user, $PlainPassword)
Validar credenciales de usuario en el propio ordenador pidiendo al usuario el nombre y la contraseña (PowerShell)
Except where otherwise noted, Jesusninoc by Jesús N. is licensed under a Creative Commons Attribution-NonCommercial 4.0 International License.