{"id":2546,"date":"2023-04-22T00:17:11","date_gmt":"2023-04-21T18:47:11","guid":{"rendered":"https:\/\/community.windowstechno.com\/community\/question\/how-to-get-gpo-startup-powershell-script-to-run-in-an-admin-context\/"},"modified":"2023-04-22T00:17:11","modified_gmt":"2023-04-21T18:47:11","slug":"how-to-get-gpo-startup-powershell-script-to-run-in-an-admin-context","status":"publish","type":"question","link":"https:\/\/community.windowstechno.com\/community\/question\/how-to-get-gpo-startup-powershell-script-to-run-in-an-admin-context\/","title":{"rendered":"How to get GPO startup Powershell script to run in an admin context?"},"content":{"rendered":"<div class=\"_2FCtq-QzlfuN-SwVMUZMM3 _2v9pwVh0VUYrmhoMv1tHPm t3_12m5t3c\">\n<div class=\"y8HYJ-y_lTUHkQIc1mdCq _2INHSNB8V5eaWp4P0rY_mE\">\n<div class=\"_2SdHzo12ISmrC8H86TgSCp _29WrubtjAcKqzJSPdQqQ4h \">\n<p><span style=\"font-size: 16px\">I&#8217;ve got a Powershell script set to run via GPO as a startup script.<\/span><\/p>\n<\/div>\n<\/div>\n<\/div>\n<div class=\"_3xX726aBn29LDbsDtzr_6E _1Ap4F5maDtT1E1YuCiaO0r D3IL3FD0RFy_mkKLPwL4\">\n<div class=\"_292iotee39Lmt0MkQZ2hPV RichTextJSON-root\">\n<p>(Computer configuration &gt; Policies &gt; Windows Settings &gt; Scripts &gt; Startup)<\/p>\n<p>The script runs on startup as expected, but one of the Powershell cmdlets fails. Specifically\u00a0<code>Get-SecureBootUEFI -name dbx<\/code>\u00a0errors out with an access denied message. This is an issue of the Powershell session needing to be run as administrator and I have verified this on the workstation I&#8217;m using as a testing ground. Opening Powershell normally and executing the cmdlet yields an identical error message. Right clicking Powershell and selecting &#8220;Run as administrator&#8221; launches a session where I can successfully execute the cmdlet.<\/p>\n<p>So after spending most of my day digging into this, everything I&#8217;m finding on the internet is indicating &#8220;To run your script with administrator privileges, run it as a startup script so it will run as SYSTEM which will give you the permissions you need.&#8221; Well I started with it as a startup script and that quite clearly isn&#8217;t running in an administrator context as evidenced by the access denied message I&#8217;m getting hit with.<\/p>\n<p>What do I have to do to allow my script to run in a true administrator context?<\/p>\n<\/div>\n<\/div>\n","protected":false},"author":0,"comment_status":"open","ping_status":"closed","template":"","question-category":[12],"question_tags":[],"class_list":["post-2546","question","type-question","status-publish","hentry","question-category-active-directory"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v26.9 - https:\/\/yoast.com\/product\/yoast-seo-wordpress\/ -->\n<title>How to get GPO startup Powershell script to run in an admin context? - WindowsTechno Community<\/title>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/community.windowstechno.com\/community\/question\/how-to-get-gpo-startup-powershell-script-to-run-in-an-admin-context\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"How to get GPO startup Powershell script to run in an admin context? - WindowsTechno Community\" \/>\n<meta property=\"og:description\" content=\"I&#8217;ve got a Powershell script set to run via GPO as a startup script. (Computer configuration &gt; Policies &gt; Windows Settings &gt; Scripts &gt; Startup) The script runs on startup as expected, but one of the Powershell cmdlets fails. Specifically\u00a0Get-SecureBootUEFI -name dbx\u00a0errors out with an access denied message. This is an issue of the Powershell [&hellip;]\" \/>\n<meta property=\"og:url\" content=\"https:\/\/community.windowstechno.com\/community\/question\/how-to-get-gpo-startup-powershell-script-to-run-in-an-admin-context\/\" \/>\n<meta property=\"og:site_name\" content=\"WindowsTechno Community\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:label1\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data1\" content=\"1 minute\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"WebPage\",\"@id\":\"https:\/\/community.windowstechno.com\/community\/question\/how-to-get-gpo-startup-powershell-script-to-run-in-an-admin-context\/\",\"url\":\"https:\/\/community.windowstechno.com\/community\/question\/how-to-get-gpo-startup-powershell-script-to-run-in-an-admin-context\/\",\"name\":\"How to get GPO startup Powershell script to run in an admin context? - WindowsTechno Community\",\"isPartOf\":{\"@id\":\"https:\/\/community.windowstechno.com\/community\/#website\"},\"datePublished\":\"2023-04-21T18:47:11+00:00\",\"breadcrumb\":{\"@id\":\"https:\/\/community.windowstechno.com\/community\/question\/how-to-get-gpo-startup-powershell-script-to-run-in-an-admin-context\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/community.windowstechno.com\/community\/question\/how-to-get-gpo-startup-powershell-script-to-run-in-an-admin-context\/\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/community.windowstechno.com\/community\/question\/how-to-get-gpo-startup-powershell-script-to-run-in-an-admin-context\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\/\/community.windowstechno.com\/community\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Questions\",\"item\":\"https:\/\/community.windowstechno.com\/community\/questions\/\"},{\"@type\":\"ListItem\",\"position\":3,\"name\":\"How to get GPO startup Powershell script to run in an admin context?\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/community.windowstechno.com\/community\/#website\",\"url\":\"https:\/\/community.windowstechno.com\/community\/\",\"name\":\"WindowsTechno Community\",\"description\":\"\",\"publisher\":{\"@id\":\"https:\/\/community.windowstechno.com\/community\/#organization\"},\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/community.windowstechno.com\/community\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"},{\"@type\":\"Organization\",\"@id\":\"https:\/\/community.windowstechno.com\/community\/#organization\",\"name\":\"WindowsTechno Community\",\"url\":\"https:\/\/community.windowstechno.com\/community\/\",\"logo\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/community.windowstechno.com\/community\/#\/schema\/logo\/image\/\",\"url\":\"https:\/\/community.windowstechno.com\/community\/wp-content\/uploads\/2023\/02\/WindowsTechnoLogo.jpg\",\"contentUrl\":\"https:\/\/community.windowstechno.com\/community\/wp-content\/uploads\/2023\/02\/WindowsTechnoLogo.jpg\",\"width\":335,\"height\":101,\"caption\":\"WindowsTechno Community\"},\"image\":{\"@id\":\"https:\/\/community.windowstechno.com\/community\/#\/schema\/logo\/image\/\"}}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"How to get GPO startup Powershell script to run in an admin context? - WindowsTechno Community","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/community.windowstechno.com\/community\/question\/how-to-get-gpo-startup-powershell-script-to-run-in-an-admin-context\/","og_locale":"en_US","og_type":"article","og_title":"How to get GPO startup Powershell script to run in an admin context? - WindowsTechno Community","og_description":"I&#8217;ve got a Powershell script set to run via GPO as a startup script. (Computer configuration &gt; Policies &gt; Windows Settings &gt; Scripts &gt; Startup) The script runs on startup as expected, but one of the Powershell cmdlets fails. Specifically\u00a0Get-SecureBootUEFI -name dbx\u00a0errors out with an access denied message. This is an issue of the Powershell [&hellip;]","og_url":"https:\/\/community.windowstechno.com\/community\/question\/how-to-get-gpo-startup-powershell-script-to-run-in-an-admin-context\/","og_site_name":"WindowsTechno Community","twitter_card":"summary_large_image","twitter_misc":{"Est. reading time":"1 minute"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"WebPage","@id":"https:\/\/community.windowstechno.com\/community\/question\/how-to-get-gpo-startup-powershell-script-to-run-in-an-admin-context\/","url":"https:\/\/community.windowstechno.com\/community\/question\/how-to-get-gpo-startup-powershell-script-to-run-in-an-admin-context\/","name":"How to get GPO startup Powershell script to run in an admin context? - WindowsTechno Community","isPartOf":{"@id":"https:\/\/community.windowstechno.com\/community\/#website"},"datePublished":"2023-04-21T18:47:11+00:00","breadcrumb":{"@id":"https:\/\/community.windowstechno.com\/community\/question\/how-to-get-gpo-startup-powershell-script-to-run-in-an-admin-context\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/community.windowstechno.com\/community\/question\/how-to-get-gpo-startup-powershell-script-to-run-in-an-admin-context\/"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/community.windowstechno.com\/community\/question\/how-to-get-gpo-startup-powershell-script-to-run-in-an-admin-context\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/community.windowstechno.com\/community\/"},{"@type":"ListItem","position":2,"name":"Questions","item":"https:\/\/community.windowstechno.com\/community\/questions\/"},{"@type":"ListItem","position":3,"name":"How to get GPO startup Powershell script to run in an admin context?"}]},{"@type":"WebSite","@id":"https:\/\/community.windowstechno.com\/community\/#website","url":"https:\/\/community.windowstechno.com\/community\/","name":"WindowsTechno Community","description":"","publisher":{"@id":"https:\/\/community.windowstechno.com\/community\/#organization"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/community.windowstechno.com\/community\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":"Organization","@id":"https:\/\/community.windowstechno.com\/community\/#organization","name":"WindowsTechno Community","url":"https:\/\/community.windowstechno.com\/community\/","logo":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/community.windowstechno.com\/community\/#\/schema\/logo\/image\/","url":"https:\/\/community.windowstechno.com\/community\/wp-content\/uploads\/2023\/02\/WindowsTechnoLogo.jpg","contentUrl":"https:\/\/community.windowstechno.com\/community\/wp-content\/uploads\/2023\/02\/WindowsTechnoLogo.jpg","width":335,"height":101,"caption":"WindowsTechno Community"},"image":{"@id":"https:\/\/community.windowstechno.com\/community\/#\/schema\/logo\/image\/"}}]}},"_links":{"self":[{"href":"https:\/\/community.windowstechno.com\/community\/wp-json\/wp\/v2\/question\/2546","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/community.windowstechno.com\/community\/wp-json\/wp\/v2\/question"}],"about":[{"href":"https:\/\/community.windowstechno.com\/community\/wp-json\/wp\/v2\/types\/question"}],"replies":[{"embeddable":true,"href":"https:\/\/community.windowstechno.com\/community\/wp-json\/wp\/v2\/comments?post=2546"}],"wp:attachment":[{"href":"https:\/\/community.windowstechno.com\/community\/wp-json\/wp\/v2\/media?parent=2546"}],"wp:term":[{"taxonomy":"question-category","embeddable":true,"href":"https:\/\/community.windowstechno.com\/community\/wp-json\/wp\/v2\/question-category?post=2546"},{"taxonomy":"question_tags","embeddable":true,"href":"https:\/\/community.windowstechno.com\/community\/wp-json\/wp\/v2\/question_tags?post=2546"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}