{"id":3929,"date":"2019-02-11T21:40:06","date_gmt":"2019-02-11T21:40:06","guid":{"rendered":"https:\/\/pariswells.com\/blog\/?p=3929"},"modified":"2019-02-11T21:40:06","modified_gmt":"2019-02-11T21:40:06","slug":"how-to-diagnose-issues-with-powershell-scripts-running-in-intune","status":"publish","type":"post","link":"https:\/\/pariswells.com\/blog\/intune\/how-to-diagnose-issues-with-powershell-scripts-running-in-intune","title":{"rendered":"How to diagnose issues with Powershell Scripts Running in Intune"},"content":{"rendered":"<p><a href=\"https:\/\/oliverkieselbach.com\/2017\/11\/29\/deep-dive-microsoft-intune-management-extension-powershell-scripts\/\">Following on from this great article<\/a><\/p><p>The Powershell Script History and logs are stored in the following registry location<\/p><p>HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\IntuneManagementExtension\\Policies<\/p><p>You will need to navigate to a subtree in their GUID<\/p><p id=\"LUFAoqL\"><img loading=\"lazy\" decoding=\"async\" width=\"324\" height=\"199\" class=\"alignnone size-full wp-image-3932  img-responsive\" src=\"https:\/\/pariswells.com\/blog\/wp-content\/uploads\/2019\/02\/img_5c61e930d29b2.png\" alt=\"\" srcset=\"https:\/\/pariswells.com\/blog\/wp-content\/uploads\/2019\/02\/img_5c61e930d29b2.png 324w, https:\/\/pariswells.com\/blog\/wp-content\/uploads\/2019\/02\/img_5c61e930d29b2-300x184.png 300w\" sizes=\"auto, (max-width: 324px) 100vw, 324px\" \/><\/p><h3><strong>How do I get the GUID for my Intune Script?<\/strong><\/h3><p id=\"nVvWfAE\"><img loading=\"lazy\" decoding=\"async\" width=\"1204\" height=\"106\" class=\"alignnone size-full wp-image-3934  img-responsive\" src=\"https:\/\/pariswells.com\/blog\/wp-content\/uploads\/2019\/02\/img_5c61ea04e1230.png\" alt=\"\" srcset=\"https:\/\/pariswells.com\/blog\/wp-content\/uploads\/2019\/02\/img_5c61ea04e1230.png 1204w, https:\/\/pariswells.com\/blog\/wp-content\/uploads\/2019\/02\/img_5c61ea04e1230-300x26.png 300w, https:\/\/pariswells.com\/blog\/wp-content\/uploads\/2019\/02\/img_5c61ea04e1230-768x68.png 768w, https:\/\/pariswells.com\/blog\/wp-content\/uploads\/2019\/02\/img_5c61ea04e1230-1024x90.png 1024w\" sizes=\"auto, (max-width: 1204px) 100vw, 1204px\" \/><\/p><h2>Diagnosing Failures<\/h2><p>A result was coming Failed with the below<\/p><pre>\u00ef\u00bf\u00bd\u00ef\u00bf\u00bd$ : The term '\u00ef\u00bf\u00bd\u00ef\u00bf\u00bd$' is not recognized as the name of a cmdlet, function, script file, or operable program. <br \/>Check the spelling of the name, or if a path was included, verify that the path is correct and try again.<br \/>At C:\\Program Files (x86)\\Microsoft Intune Management <br \/>Extension\\Policies\\Scripts\\ee7f18e5-b666-4c11-be72-9d5490a49e23_a39275a0-659c-45a9-9f1a-d312ae484eda.ps1:1 char:1<br \/>+ \u00ef\u00bf\u00bd\u00ef\u00bf\u00bd$<\/pre><p>On running the scripts get copied here briefly then run and deleted :\u00a0C:\\Program Files (x86)\\Microsoft Intune Management Extension\\Policies\\Scripts<\/p><p>You have to be fast but you can copy the .ps1 file to e.g. C:\\Temp and check what the machine was getting ,\u00a0to resolve this issue I had to recopy the file into Powershell ISE and resave and upload.<\/p><p id=\"nVvWfAE\">\u00a0<\/p><h3><strong>How to Run the Scripts Manually<\/strong><\/h3><p>Change\u00a0<strong>DownloadCount<\/strong>and\u00a0<strong>ErrorCode<\/strong>\u00a0to\u00a0<strong>0<\/strong>\u00a0and set\u00a0<strong>Result<\/strong>\u00a0and\u00a0<strong>ResultDetails<\/strong>\u00a0to\u00a0<strong>nothing<\/strong>\u00a0(empty string). After this we just restart the Microsoft Intune Management Extension Service (IntuneManagementExtension) and the script will rerun again on this device<\/p><p><img loading=\"lazy\" decoding=\"async\" width=\"677\" height=\"194\" class=\"alignnone size-full wp-image-3931  img-responsive\" src=\"https:\/\/pariswells.com\/blog\/wp-content\/uploads\/2019\/02\/img_5c61e8a4d3067.png\" alt=\"\" srcset=\"https:\/\/pariswells.com\/blog\/wp-content\/uploads\/2019\/02\/img_5c61e8a4d3067.png 677w, https:\/\/pariswells.com\/blog\/wp-content\/uploads\/2019\/02\/img_5c61e8a4d3067-300x86.png 300w\" sizes=\"auto, (max-width: 677px) 100vw, 677px\" \/><\/p><p id=\"EQIXuzz\"><img loading=\"lazy\" decoding=\"async\" width=\"698\" height=\"49\" class=\"alignnone size-full wp-image-3930  img-responsive\" src=\"https:\/\/pariswells.com\/blog\/wp-content\/uploads\/2019\/02\/img_5c61e88cba4ae.png\" alt=\"\" srcset=\"https:\/\/pariswells.com\/blog\/wp-content\/uploads\/2019\/02\/img_5c61e88cba4ae.png 698w, https:\/\/pariswells.com\/blog\/wp-content\/uploads\/2019\/02\/img_5c61e88cba4ae-300x21.png 300w\" sizes=\"auto, (max-width: 698px) 100vw, 698px\" \/><\/p><p>&nbsp;<\/p><h3>Log Directory<\/h3><p>C:\\ProgramData\\Microsoft\\IntuneManagementExtension\\Logs<\/p><div class=\"wp-block-image\">\u00a0<\/div>","protected":false},"excerpt":{"rendered":"<p>Following on from this great articleThe Powershell Script History and logs are stored in the following registry locationHKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\IntuneManagementExtension\\PoliciesYou will need to navigate to a subtree in their [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[2836],"tags":[2838,1344,2837,576],"class_list":["post-3929","post","type-post","status-publish","format-standard","hentry","category-intune","tag-code-99","tag-error","tag-intune","tag-powershell"],"aioseo_notices":[],"_links":{"self":[{"href":"https:\/\/pariswells.com\/blog\/wp-json\/wp\/v2\/posts\/3929","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/pariswells.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/pariswells.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/pariswells.com\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/pariswells.com\/blog\/wp-json\/wp\/v2\/comments?post=3929"}],"version-history":[{"count":1,"href":"https:\/\/pariswells.com\/blog\/wp-json\/wp\/v2\/posts\/3929\/revisions"}],"predecessor-version":[{"id":3935,"href":"https:\/\/pariswells.com\/blog\/wp-json\/wp\/v2\/posts\/3929\/revisions\/3935"}],"wp:attachment":[{"href":"https:\/\/pariswells.com\/blog\/wp-json\/wp\/v2\/media?parent=3929"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/pariswells.com\/blog\/wp-json\/wp\/v2\/categories?post=3929"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/pariswells.com\/blog\/wp-json\/wp\/v2\/tags?post=3929"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}