Search code examples
windowspowershellktpass

Password parameter with special characters


I've looked through a ton of posts on here and across the web about special characters in Powershell, but no matter what I've tried so far my command continues to get caught up on special characters. I'm trying to generate a keytab with the command:

ktpass -out bosso.keytab -princ serviceAccount@DOMAIN.COM -pass "XX&XX"XX&" -kvno 255 -ptype KRB5_NT_PRINCIPAL -crypto AES256-SHA1

I've tried assigning the password to a variable, using the backtick to escape, double-quotes with escapes, single quotes. I'm at a loss for what else to try here.


Solution

  • Thank you to Matt for the helpful comment! I was not aware of the stop parsing parameter, but using ktpass --% ... prevented Powershell from interpreting the quotation marks as part of the command.