{"id":3859,"date":"2022-03-21T12:11:18","date_gmt":"2022-03-21T20:11:18","guid":{"rendered":"https:\/\/wonghoi.humgar.com\/blog\/?p=3859"},"modified":"2022-03-21T12:11:19","modified_gmt":"2022-03-21T20:11:19","slug":"using-3rd-party-packages-for-powershell-install-module","status":"publish","type":"post","link":"https:\/\/wonghoi.humgar.com\/blog\/2022\/03\/21\/using-3rd-party-packages-for-powershell-install-module\/","title":{"rendered":"Using 3rd party packages for Powershell Install-Module"},"content":{"rendered":"\n<p>It make sense by default if you download 3rd party powershell packages like <a href=\"https:\/\/github.com\/potatoqualitee\/kbupdate\" data-type=\"URL\" data-id=\"https:\/\/github.com\/potatoqualitee\/kbupdate\">kbupdate<\/a>, it should not run right away until you&#8217;ve done your due dilligence. You&#8217;ll get a warning like this during installation:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>Untrusted repository\nYou are installing the modules from an untrusted repository. If you trust this repository, change its InstallationPolicy value by running the Set-PSRepository cmdlet. Are you sure you want to install the modules from 'PSGallery'?<\/code><\/pre>\n\n\n\n<p>But when I try to use it, I get an error message:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>Get-KbUpdate : The 'Get-KbUpdate' command was found in the module 'kbupdate', but the module could not be loaded. For more information, run 'Import-Module kbupdate'.<\/code><\/pre>\n\n\n\n<p>Import-Module gives a cryptic message like this:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>Import-Module : Errors occurred while loading the format data file:\nD:\\Administrator\\Documents\\WindowsPowerShell\\Modules\\PSFramework\\1.6.214\\xml\\PSFramework.Format.ps1xml, ,\nD:\\Administrator\\Documents\\WindowsPowerShell\\Modules\\PSFramework\\1.6.214\\xml\\PSFramework.Format.ps1xml: The file was\nskipped because of the following validation exception: File\nD:\\Administrator\\Documents\\WindowsPowerShell\\Modules\\PSFramework\\1.6.214\\xml\\PSFramework.Format.ps1xml cannot be\nloaded <strong>because running scripts is disabled on this system<\/strong>. For more information, see about_Execution_Policies at\nhttps:\/go.microsoft.com\/fwlink\/?LinkID=135170..<\/code><\/pre>\n\n\n\n<p>Turns out either the package needs to be marked safe or <a href=\"https:\/\/stackoverflow.com\/questions\/67150436\/cannot-be-loaded-because-running-scripts-is-disabled-on-this-system-for-more-in\" target=\"_blank\" rel=\"noreferrer noopener\">just stop checking altogether<\/a>:<\/p>\n\n\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"powershell\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">Set-ExecutionPolicy -Scope CurrentUser -ExecutionPolicy Unrestricted<\/pre>\n<div class=\"pvc_clear\"><\/div><p id=\"pvc_stats_3859\" class=\"pvc_stats all  \" data-element-id=\"3859\" style=\"\"><i class=\"pvc-stats-icon medium\" aria-hidden=\"true\"><svg aria-hidden=\"true\" focusable=\"false\" data-prefix=\"far\" data-icon=\"chart-bar\" role=\"img\" xmlns=\"http:\/\/www.w3.org\/2000\/svg\" viewBox=\"0 0 512 512\" class=\"svg-inline--fa fa-chart-bar fa-w-16 fa-2x\"><path fill=\"currentColor\" d=\"M396.8 352h22.4c6.4 0 12.8-6.4 12.8-12.8V108.8c0-6.4-6.4-12.8-12.8-12.8h-22.4c-6.4 0-12.8 6.4-12.8 12.8v230.4c0 6.4 6.4 12.8 12.8 12.8zm-192 0h22.4c6.4 0 12.8-6.4 12.8-12.8V140.8c0-6.4-6.4-12.8-12.8-12.8h-22.4c-6.4 0-12.8 6.4-12.8 12.8v198.4c0 6.4 6.4 12.8 12.8 12.8zm96 0h22.4c6.4 0 12.8-6.4 12.8-12.8V204.8c0-6.4-6.4-12.8-12.8-12.8h-22.4c-6.4 0-12.8 6.4-12.8 12.8v134.4c0 6.4 6.4 12.8 12.8 12.8zM496 400H48V80c0-8.84-7.16-16-16-16H16C7.16 64 0 71.16 0 80v336c0 17.67 14.33 32 32 32h464c8.84 0 16-7.16 16-16v-16c0-8.84-7.16-16-16-16zm-387.2-48h22.4c6.4 0 12.8-6.4 12.8-12.8v-70.4c0-6.4-6.4-12.8-12.8-12.8h-22.4c-6.4 0-12.8 6.4-12.8 12.8v70.4c0 6.4 6.4 12.8 12.8 12.8z\" class=\"\"><\/path><\/svg><\/i> <img loading=\"lazy\" decoding=\"async\" width=\"16\" height=\"16\" alt=\"Loading\" src=\"https:\/\/wonghoi.humgar.com\/blog\/wp-content\/plugins\/page-views-count\/ajax-loader-2x.gif\" border=0 \/><\/p><div class=\"pvc_clear\"><\/div>","protected":false},"excerpt":{"rendered":"<p>It make sense by default if you download 3rd party powershell packages like kbupdate, it should not run right away until you&#8217;ve done your due dilligence. You&#8217;ll get a warning like this during installation: But when I try to use &hellip; <a href=\"https:\/\/wonghoi.humgar.com\/blog\/2022\/03\/21\/using-3rd-party-packages-for-powershell-install-module\/\">Continue reading <span class=\"meta-nav\">&rarr;<\/span><\/a><\/p>\n<div class=\"pvc_clear\"><\/div>\n<p id=\"pvc_stats_3859\" class=\"pvc_stats all  \" data-element-id=\"3859\" style=\"\"><i class=\"pvc-stats-icon medium\" aria-hidden=\"true\"><svg aria-hidden=\"true\" focusable=\"false\" data-prefix=\"far\" data-icon=\"chart-bar\" role=\"img\" xmlns=\"http:\/\/www.w3.org\/2000\/svg\" viewBox=\"0 0 512 512\" class=\"svg-inline--fa fa-chart-bar fa-w-16 fa-2x\"><path fill=\"currentColor\" d=\"M396.8 352h22.4c6.4 0 12.8-6.4 12.8-12.8V108.8c0-6.4-6.4-12.8-12.8-12.8h-22.4c-6.4 0-12.8 6.4-12.8 12.8v230.4c0 6.4 6.4 12.8 12.8 12.8zm-192 0h22.4c6.4 0 12.8-6.4 12.8-12.8V140.8c0-6.4-6.4-12.8-12.8-12.8h-22.4c-6.4 0-12.8 6.4-12.8 12.8v198.4c0 6.4 6.4 12.8 12.8 12.8zm96 0h22.4c6.4 0 12.8-6.4 12.8-12.8V204.8c0-6.4-6.4-12.8-12.8-12.8h-22.4c-6.4 0-12.8 6.4-12.8 12.8v134.4c0 6.4 6.4 12.8 12.8 12.8zM496 400H48V80c0-8.84-7.16-16-16-16H16C7.16 64 0 71.16 0 80v336c0 17.67 14.33 32 32 32h464c8.84 0 16-7.16 16-16v-16c0-8.84-7.16-16-16-16zm-387.2-48h22.4c6.4 0 12.8-6.4 12.8-12.8v-70.4c0-6.4-6.4-12.8-12.8-12.8h-22.4c-6.4 0-12.8 6.4-12.8 12.8v70.4c0 6.4 6.4 12.8 12.8 12.8z\" class=\"\"><\/path><\/svg><\/i> <img loading=\"lazy\" decoding=\"async\" width=\"16\" height=\"16\" alt=\"Loading\" src=\"https:\/\/wonghoi.humgar.com\/blog\/wp-content\/plugins\/page-views-count\/ajax-loader-2x.gif\" border=0 \/><\/p>\n<div class=\"pvc_clear\"><\/div>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"inline_featured_image":false,"footnotes":""},"categories":[1],"tags":[],"class_list":["post-3859","post","type-post","status-publish","format-standard","hentry","category-uncategorized"],"_links":{"self":[{"href":"https:\/\/wonghoi.humgar.com\/blog\/wp-json\/wp\/v2\/posts\/3859","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/wonghoi.humgar.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/wonghoi.humgar.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/wonghoi.humgar.com\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/wonghoi.humgar.com\/blog\/wp-json\/wp\/v2\/comments?post=3859"}],"version-history":[{"count":1,"href":"https:\/\/wonghoi.humgar.com\/blog\/wp-json\/wp\/v2\/posts\/3859\/revisions"}],"predecessor-version":[{"id":3860,"href":"https:\/\/wonghoi.humgar.com\/blog\/wp-json\/wp\/v2\/posts\/3859\/revisions\/3860"}],"wp:attachment":[{"href":"https:\/\/wonghoi.humgar.com\/blog\/wp-json\/wp\/v2\/media?parent=3859"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/wonghoi.humgar.com\/blog\/wp-json\/wp\/v2\/categories?post=3859"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/wonghoi.humgar.com\/blog\/wp-json\/wp\/v2\/tags?post=3859"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}