Guest User

Untitled

a guest
Dec 22nd, 2017
81
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.44 KB | None | 0 0
  1. Function Get-BasicCredentials(){
  2.  
  3. Do { $username = Read-host "Enter your username"}
  4. while ($username -eq "")
  5.  
  6. Do { $response = Read-host "Enter your password" -AsSecureString}
  7.  
  8. while ($response -eq "")
  9.  
  10. $Ptr = [System.Runtime.InteropServices.Marshal]::SecureStringToCoTaskMemUnicode($response)
  11.  
  12. $password = [System.Runtime.InteropServices.Marshal]::PtrToStringUni($Ptr)
  13.  
  14. return @{username=$username;password=$Password;}
  15. }
Add Comment
Please, Sign In to add comment