{"id":12952,"date":"2018-09-29T08:06:53","date_gmt":"2018-09-29T08:06:53","guid":{"rendered":"https:\/\/www.top-password.com\/blog\/?p=12952"},"modified":"2018-09-29T08:11:01","modified_gmt":"2018-09-29T08:11:01","slug":"add-run-with-powershell-admin-context-menu-for-ps1-files","status":"publish","type":"post","link":"https:\/\/www.top-password.com\/blog\/add-run-with-powershell-admin-context-menu-for-ps1-files\/","title":{"rendered":"Add &#8220;Run with PowerShell (Admin)&#8221; Context Menu for .PS1 Files"},"content":{"rendered":"<p>How to add &#8220;Run as administrator&#8221; to PS1 file context menu in Windows 10? Before you can run PowerShell script with admin rights, you have to launch the elevated PowerShell console firstly. To simplify this process, you can add &#8220;<em>Run with PowerShell (Admin)<\/em>&#8221; to the right-click context menu for .PS1 files.<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/www.top-password.com\/blog\/wp-content\/uploads\/2018\/09\/run-with-powershell-admin.png\" alt=\"\" width=\"375\" height=\"450\" class=\"alignnone size-full wp-image-12954\" \/><\/p>\n<p><strong>How to Add &#8220;Run with PowerShell (Admin)&#8221; Context Menu for .PS1 Files<\/strong><\/p>\n<ol>\n<li>Open the Registry Editor. Paste the following registry location into the address bar, and then press Enter.\n<p><code>HKEY_CLASSES_ROOT\\Microsoft.PowerShellScript.1\\Shell<\/code><\/p>\n<p><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/www.top-password.com\/blog\/wp-content\/uploads\/2018\/09\/add-run-with-powershell-subkey.png\" alt=\"\" width=\"597\" height=\"294\" class=\"alignnone size-full wp-image-12960\" \/><\/p>\n<p> \tRight-click on the <strong>Shell<\/strong> key and select <strong>New<\/strong>-&gt;<strong>Key<\/strong>, name it &#8220;<strong>Run with PowerShell (Admin)<\/strong>&#8220;. Underneath that, create another subkey called &#8220;<strong>Command<\/strong>&#8220;.<\/li>\n<li>Select the <strong>Command<\/strong> subkey in the left pane, and then double-click the &#8220;<strong>(Default)<\/strong>&#8221; string in the right pane.\n<p><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/www.top-password.com\/blog\/wp-content\/uploads\/2018\/09\/double-click-default-registry-value.png\" alt=\"\" width=\"597\" height=\"313\" class=\"alignnone size-full wp-image-12961\" \/>\n<\/li>\n<li>Copy and paste the following command into the <strong>Value data<\/strong> field, and click <strong>OK<\/strong>.<br \/>\n<code><br \/>\n\"C:\\Windows\\System32\\WindowsPowerShell\\v1.0\\powershell.exe\" \"-Command\" \"\"& {Start-Process PowerShell.exe -ArgumentList '-ExecutionPolicy RemoteSigned -File \\\"%1\\\"' -Verb RunAs}\"<\/code><\/p>\n<p><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/www.top-password.com\/blog\/wp-content\/uploads\/2018\/09\/run-with-powershell-admin-command.png\" alt=\"\" width=\"382\" height=\"170\" class=\"alignnone size-full wp-image-12962\" \/>\n<\/li>\n<li>Close Registry Editor. Now you should see a new context menu entry called &#8220;<em>Run with PowerShell (Admin)<\/em>&#8221; when you right-click any .PS1 script.<\/li>\n<\/ol>\n<!-- AddThis Advanced Settings generic via filter on the_content --><!-- AddThis Share Buttons generic via filter on the_content -->","protected":false},"excerpt":{"rendered":"<p>How to add &#8220;Run as administrator&#8221; to PS1 file context menu in Windows 10? Before you can run PowerShell script with admin rights, you have to launch the elevated PowerShell console firstly. To simplify this process, you can add &#8220;Run with PowerShell (Admin)&#8221; to the right-click context menu for .PS1 files. How to Add &#8220;Run [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1,10,1894],"tags":[3989,3987,3988],"class_list":["post-12952","post","type-post","status-publish","format-standard","hentry","category-others","category-tips-tricks","category-windows-10","tag-right-click-run-with-powershell-as-administrator","tag-run-powershell-as-administrator","tag-run-powershell-as-administrator-context-menu"],"_links":{"self":[{"href":"https:\/\/www.top-password.com\/blog\/wp-json\/wp\/v2\/posts\/12952","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.top-password.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.top-password.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.top-password.com\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.top-password.com\/blog\/wp-json\/wp\/v2\/comments?post=12952"}],"version-history":[{"count":6,"href":"https:\/\/www.top-password.com\/blog\/wp-json\/wp\/v2\/posts\/12952\/revisions"}],"predecessor-version":[{"id":12966,"href":"https:\/\/www.top-password.com\/blog\/wp-json\/wp\/v2\/posts\/12952\/revisions\/12966"}],"wp:attachment":[{"href":"https:\/\/www.top-password.com\/blog\/wp-json\/wp\/v2\/media?parent=12952"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.top-password.com\/blog\/wp-json\/wp\/v2\/categories?post=12952"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.top-password.com\/blog\/wp-json\/wp\/v2\/tags?post=12952"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}