{"id":5831,"date":"2008-06-20T17:09:00","date_gmt":"2008-06-20T17:09:00","guid":{"rendered":"https:\/\/blogs.msdn.microsoft.com\/powershell\/2008\/06\/20\/getting-credentials-from-the-command-line\/"},"modified":"2019-02-18T13:13:09","modified_gmt":"2019-02-18T20:13:09","slug":"getting-credentials-from-the-command-line","status":"publish","type":"post","link":"https:\/\/devblogs.microsoft.com\/powershell\/getting-credentials-from-the-command-line\/","title":{"rendered":"Getting Credentials From The Command Line"},"content":{"rendered":"<p>When you use the&nbsp;Get-Credential cmdlet, you get a GUI dialog box to enter the credentials.&nbsp; This is the &#8220;Common Criteria Certified&#8221; way of handling credentials.&nbsp; It is also a pain in the butt at times.&nbsp; If you are an admin, you can alter this and request credentials via the command line as follows:<\/p>\n<p>&nbsp;<\/p>\n<p class=\"MsoNormal\"><span><font size=\"3\"><font face=\"Calibri\">PS&gt; <strong>$key = &#8220;HKLM:\\SOFTWARE\\Microsoft\\PowerShell\\1\\ShellIds&#8221;<\/strong><br \/>PS&gt; <strong>Set-ItemProperty $key ConsolePrompting True<br \/><\/strong>PS&gt; <strong>Get-Credential<\/strong><\/font><\/font><\/span><\/p>\n<p class=\"MsoNormal\"><span><font size=\"3\"><font face=\"Calibri\">cmdlet Get-Credential at command pipeline position 1<br \/>Supply values for the following parameters:<br \/>Credential<br \/>User: <strong>ntdev\\jsnover<\/strong><br \/>Password for user ntdev\\jsnover: <strong>**************<\/strong><\/font><\/font><\/span><\/p>\n<p><span><font size=\"3\"><font face=\"Calibri\"><\/p>\n<p class=\"MsoNormal\">UserName&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Password<br \/>&#8212;&#8212;&#8211;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &#8212;&#8212;&#8211;<br \/>ntdev\\jsnover&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; System.Security.SecureString<\/p>\n<p class=\"MsoNormal\">&nbsp;<\/p>\n<p class=\"MsoNormal\">Enjoy!<\/p>\n<p class=\"MsoNormal\">&nbsp;<\/p>\n<p class=\"MsoNormal\">Jeffrey Snover [MSFT]<br \/>Windows Management Partner Architect<br \/>Visit the Windows PowerShell Team blog at:&nbsp;&nbsp;&nbsp; <a href=\"http:\/\/blogs.msdn.com\/PowerShell\">http:\/\/blogs.msdn.com\/PowerShell<\/a><br \/>Visit the Windows PowerShell ScriptCenter at:&nbsp; <a href=\"http:\/\/www.microsoft.com\/technet\/scriptcenter\/hubs\/msh.mspx\">http:\/\/www.microsoft.com\/technet\/scriptcenter\/hubs\/msh.mspx<\/a><\/p>\n<p><\/font><\/font><\/span><\/p>\n","protected":false},"excerpt":{"rendered":"<p>When you use the&nbsp;Get-Credential cmdlet, you get a GUI dialog box to enter the credentials.&nbsp; This is the &#8220;Common Criteria Certified&#8221; way of handling credentials.&nbsp; It is also a pain in the butt at times.&nbsp; If you are an admin, you can alter this and request credentials via the command line as follows: &nbsp; PS&gt; [&hellip;]<\/p>\n","protected":false},"author":600,"featured_media":13641,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"footnotes":""},"categories":[1],"tags":[171],"class_list":["post-5831","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-powershell","tag-get-credential"],"acf":[],"blog_post_summary":"<p>When you use the&nbsp;Get-Credential cmdlet, you get a GUI dialog box to enter the credentials.&nbsp; This is the &#8220;Common Criteria Certified&#8221; way of handling credentials.&nbsp; It is also a pain in the butt at times.&nbsp; If you are an admin, you can alter this and request credentials via the command line as follows: &nbsp; PS&gt; [&hellip;]<\/p>\n","_links":{"self":[{"href":"https:\/\/devblogs.microsoft.com\/powershell\/wp-json\/wp\/v2\/posts\/5831","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/devblogs.microsoft.com\/powershell\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/devblogs.microsoft.com\/powershell\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/powershell\/wp-json\/wp\/v2\/users\/600"}],"replies":[{"embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/powershell\/wp-json\/wp\/v2\/comments?post=5831"}],"version-history":[{"count":0,"href":"https:\/\/devblogs.microsoft.com\/powershell\/wp-json\/wp\/v2\/posts\/5831\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/powershell\/wp-json\/wp\/v2\/media\/13641"}],"wp:attachment":[{"href":"https:\/\/devblogs.microsoft.com\/powershell\/wp-json\/wp\/v2\/media?parent=5831"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/powershell\/wp-json\/wp\/v2\/categories?post=5831"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/powershell\/wp-json\/wp\/v2\/tags?post=5831"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}