{"id":14161,"date":"2017-12-07T06:30:15","date_gmt":"2017-12-07T14:30:15","guid":{"rendered":"https:\/\/www.sapien.com\/blog\/?p=14161"},"modified":"2017-12-06T19:41:56","modified_gmt":"2017-12-07T03:41:56","slug":"powershell-studio-feature-nugget-refreshing-local-cache-powershell-cmdlets-and-modules","status":"publish","type":"post","link":"https:\/\/dev.sapien.com\/blog\/2017\/12\/07\/powershell-studio-feature-nugget-refreshing-local-cache-powershell-cmdlets-and-modules\/","title":{"rendered":"PowerShell Studio Feature Nugget &#8211; Refreshing Local Cache PowerShell Cmdlets and Modules"},"content":{"rendered":"<p>One feature of PowerShell Studio that you want to pay attention to is the <strong>PowerShell<\/strong> <strong>Cache Editor<\/strong>.\u00a0When PowerShell Studio is opened for the first time, it creates a cache of all available cmdlets and modules that are on your local machine. The *cached cmdlets and modules are used to provide PrimalSense, syntax coloring for your PowerShell scripts, and are displayed in the Object Browser.<\/p>\n<p><a href=\"https:\/\/www.sapien.com\/blog\/wp-content\/uploads\/2017\/11\/PS2017_OB_Cache_03_2017-11-08_17-10-01.png\"><img loading=\"lazy\" decoding=\"async\" class=\"alignnone wp-image-14185\" src=\"https:\/\/www.sapien.com\/blog\/wp-content\/uploads\/2017\/11\/PS2017_OB_Cache_03_2017-11-08_17-10-01-300x115.png\" alt=\"\" width=\"420\" height=\"161\" srcset=\"https:\/\/dev.sapien.com\/blog\/wp-content\/uploads\/2017\/11\/PS2017_OB_Cache_03_2017-11-08_17-10-01-300x115.png 300w, https:\/\/dev.sapien.com\/blog\/wp-content\/uploads\/2017\/11\/PS2017_OB_Cache_03_2017-11-08_17-10-01-768x294.png 768w, https:\/\/dev.sapien.com\/blog\/wp-content\/uploads\/2017\/11\/PS2017_OB_Cache_03_2017-11-08_17-10-01-1024x392.png 1024w, https:\/\/dev.sapien.com\/blog\/wp-content\/uploads\/2017\/11\/PS2017_OB_Cache_03_2017-11-08_17-10-01-848x324.png 848w, https:\/\/dev.sapien.com\/blog\/wp-content\/uploads\/2017\/11\/PS2017_OB_Cache_03_2017-11-08_17-10-01.png 1127w\" sizes=\"auto, (max-width: 420px) 100vw, 420px\" \/><\/a><\/p>\n<p>The module must be located in a PSModulePath directory in order to be discovered by the caching process.\u00a0Use the following PowerShell one-liner(s) to display the content stored in the PSModulePath: &#8220;<strong>$env:PSModulePath<\/strong>&#8220;, or &#8220;<strong>$env:PSModulePath.Split(&#8216;;&#8217;)<\/strong>&#8220;.<\/p>\n<p><a href=\"https:\/\/www.sapien.com\/blog\/wp-content\/uploads\/2017\/11\/PSmodulePath_01_2017-11-20_13-08-30.png\"><img loading=\"lazy\" decoding=\"async\" class=\"alignnone wp-image-14217\" src=\"https:\/\/www.sapien.com\/blog\/wp-content\/uploads\/2017\/11\/PSmodulePath_01_2017-11-20_13-08-30-300x98.png\" alt=\"\" width=\"453\" height=\"148\" srcset=\"https:\/\/dev.sapien.com\/blog\/wp-content\/uploads\/2017\/11\/PSmodulePath_01_2017-11-20_13-08-30-300x98.png 300w, https:\/\/dev.sapien.com\/blog\/wp-content\/uploads\/2017\/11\/PSmodulePath_01_2017-11-20_13-08-30-768x252.png 768w, https:\/\/dev.sapien.com\/blog\/wp-content\/uploads\/2017\/11\/PSmodulePath_01_2017-11-20_13-08-30-1024x335.png 1024w, https:\/\/dev.sapien.com\/blog\/wp-content\/uploads\/2017\/11\/PSmodulePath_01_2017-11-20_13-08-30-848x278.png 848w, https:\/\/dev.sapien.com\/blog\/wp-content\/uploads\/2017\/11\/PSmodulePath_01_2017-11-20_13-08-30.png 1508w\" sizes=\"auto, (max-width: 453px) 100vw, 453px\" \/><\/a><\/p>\n<p>Because PowerShell Studio uses a cache of the modules, newly installed modules will not be displayed automatically in the Object Browser.<\/p>\n<p>There are two ways you can update the cache:<\/p>\n<ol>\n<li><strong>Refresh Cache &#8211;\u00a0<\/strong>Refresh the cache using the \u00a0button via the Ribbon-&gt;Home-&gt;Platform-&gt;Refresh Cache.<\/li>\n<\/ol>\n<p><a href=\"https:\/\/www.sapien.com\/blog\/wp-content\/uploads\/2017\/11\/PS2017_RefreshCache_2017-11-08_23-34-13.png\"><img loading=\"lazy\" decoding=\"async\" class=\"alignnone wp-image-14182\" src=\"https:\/\/www.sapien.com\/blog\/wp-content\/uploads\/2017\/11\/PS2017_RefreshCache_2017-11-08_23-34-13-300x166.png\" alt=\"\" width=\"481\" height=\"266\" srcset=\"https:\/\/dev.sapien.com\/blog\/wp-content\/uploads\/2017\/11\/PS2017_RefreshCache_2017-11-08_23-34-13-300x166.png 300w, https:\/\/dev.sapien.com\/blog\/wp-content\/uploads\/2017\/11\/PS2017_RefreshCache_2017-11-08_23-34-13-768x425.png 768w, https:\/\/dev.sapien.com\/blog\/wp-content\/uploads\/2017\/11\/PS2017_RefreshCache_2017-11-08_23-34-13-1024x566.png 1024w, https:\/\/dev.sapien.com\/blog\/wp-content\/uploads\/2017\/11\/PS2017_RefreshCache_2017-11-08_23-34-13-848x469.png 848w, https:\/\/dev.sapien.com\/blog\/wp-content\/uploads\/2017\/11\/PS2017_RefreshCache_2017-11-08_23-34-13.png 1311w\" sizes=\"auto, (max-width: 481px) 100vw, 481px\" \/><\/a><\/p>\n<ol start=\"2\">\n<li>Or use the <strong>PowerShell Cache Editor<\/strong>\u00a0 &#8211; to modify and update the existing cache, which can be found via the Ribbon-&gt;File-&gt;Home-&gt;Platform-&gt;Edit Cache\u00a0icon.<\/li>\n<\/ol>\n<p><a href=\"https:\/\/www.sapien.com\/blog\/wp-content\/uploads\/2017\/11\/EditCache_ICO_2017-11-08_18-19-43.png\"><img loading=\"lazy\" decoding=\"async\" class=\"alignnone wp-image-14173\" src=\"https:\/\/www.sapien.com\/blog\/wp-content\/uploads\/2017\/11\/EditCache_ICO_2017-11-08_18-19-43-300x93.png\" alt=\"\" width=\"423\" height=\"131\" srcset=\"https:\/\/dev.sapien.com\/blog\/wp-content\/uploads\/2017\/11\/EditCache_ICO_2017-11-08_18-19-43-300x93.png 300w, https:\/\/dev.sapien.com\/blog\/wp-content\/uploads\/2017\/11\/EditCache_ICO_2017-11-08_18-19-43-768x238.png 768w, https:\/\/dev.sapien.com\/blog\/wp-content\/uploads\/2017\/11\/EditCache_ICO_2017-11-08_18-19-43-848x262.png 848w, https:\/\/dev.sapien.com\/blog\/wp-content\/uploads\/2017\/11\/EditCache_ICO_2017-11-08_18-19-43.png 944w\" sizes=\"auto, (max-width: 423px) 100vw, 423px\" \/><\/a><\/p>\n<p>This will open the &#8220;<strong>PowerShell Cache Editor<\/strong>&#8220;.<\/p>\n<p><a href=\"https:\/\/www.sapien.com\/blog\/wp-content\/uploads\/2017\/11\/PSCacheEditor_2017-11-08_18-31-54.png\"><img loading=\"lazy\" decoding=\"async\" class=\"alignnone wp-image-14175\" src=\"https:\/\/www.sapien.com\/blog\/wp-content\/uploads\/2017\/11\/PSCacheEditor_2017-11-08_18-31-54-300x175.png\" alt=\"\" width=\"425\" height=\"248\" srcset=\"https:\/\/dev.sapien.com\/blog\/wp-content\/uploads\/2017\/11\/PSCacheEditor_2017-11-08_18-31-54-300x175.png 300w, https:\/\/dev.sapien.com\/blog\/wp-content\/uploads\/2017\/11\/PSCacheEditor_2017-11-08_18-31-54-768x448.png 768w, https:\/\/dev.sapien.com\/blog\/wp-content\/uploads\/2017\/11\/PSCacheEditor_2017-11-08_18-31-54-1024x597.png 1024w, https:\/\/dev.sapien.com\/blog\/wp-content\/uploads\/2017\/11\/PSCacheEditor_2017-11-08_18-31-54-848x495.png 848w, https:\/\/dev.sapien.com\/blog\/wp-content\/uploads\/2017\/11\/PSCacheEditor_2017-11-08_18-31-54.png 1126w\" sizes=\"auto, (max-width: 425px) 100vw, 425px\" \/><\/a><\/p>\n<h4>Using the Cache Editor to manually add or update a module<\/h4>\n<p>In order to load the new module(s) manually, follow these steps:<\/p>\n<ol>\n<li>Open the \u201c<strong>PowerShell Cache Editor<\/strong>\u201c.<\/li>\n<li>For example, look at the SQLPS module which has two versions installed:<br \/>\n<a href=\"https:\/\/www.sapien.com\/blog\/wp-content\/uploads\/2017\/11\/Cache_SQLPS_01_2017-11-08_19-18-55.png\"><img loading=\"lazy\" decoding=\"async\" class=\"alignnone wp-image-14177\" src=\"https:\/\/www.sapien.com\/blog\/wp-content\/uploads\/2017\/11\/Cache_SQLPS_01_2017-11-08_19-18-55-300x175.png\" alt=\"\" width=\"425\" height=\"248\" srcset=\"https:\/\/dev.sapien.com\/blog\/wp-content\/uploads\/2017\/11\/Cache_SQLPS_01_2017-11-08_19-18-55-300x175.png 300w, https:\/\/dev.sapien.com\/blog\/wp-content\/uploads\/2017\/11\/Cache_SQLPS_01_2017-11-08_19-18-55-768x448.png 768w, https:\/\/dev.sapien.com\/blog\/wp-content\/uploads\/2017\/11\/Cache_SQLPS_01_2017-11-08_19-18-55-848x495.png 848w, https:\/\/dev.sapien.com\/blog\/wp-content\/uploads\/2017\/11\/Cache_SQLPS_01_2017-11-08_19-18-55.png 900w\" sizes=\"auto, (max-width: 425px) 100vw, 425px\" \/><\/a><\/li>\n<li>Uncheck the older version &#8211; 1.0, then check the newer version (14.0).<\/li>\n<li>To update the Object Browser with the changes, click on the \u201c<strong>Build Cache<\/strong>\u201c, and \u201c<strong>Close<\/strong>\u201d the editor.<br \/>\n<a href=\"https:\/\/www.sapien.com\/blog\/wp-content\/uploads\/2017\/11\/Cache_SQLPS_02_2017-11-08_19-18-55.png\"><img loading=\"lazy\" decoding=\"async\" class=\"alignnone wp-image-14178\" src=\"https:\/\/www.sapien.com\/blog\/wp-content\/uploads\/2017\/11\/Cache_SQLPS_02_2017-11-08_19-18-55-300x175.png\" alt=\"\" width=\"422\" height=\"246\" srcset=\"https:\/\/dev.sapien.com\/blog\/wp-content\/uploads\/2017\/11\/Cache_SQLPS_02_2017-11-08_19-18-55-300x175.png 300w, https:\/\/dev.sapien.com\/blog\/wp-content\/uploads\/2017\/11\/Cache_SQLPS_02_2017-11-08_19-18-55-768x448.png 768w, https:\/\/dev.sapien.com\/blog\/wp-content\/uploads\/2017\/11\/Cache_SQLPS_02_2017-11-08_19-18-55-1024x597.png 1024w, https:\/\/dev.sapien.com\/blog\/wp-content\/uploads\/2017\/11\/Cache_SQLPS_02_2017-11-08_19-18-55-848x495.png 848w, https:\/\/dev.sapien.com\/blog\/wp-content\/uploads\/2017\/11\/Cache_SQLPS_02_2017-11-08_19-18-55.png 1126w\" sizes=\"auto, (max-width: 422px) 100vw, 422px\" \/><\/a><\/li>\n<\/ol>\n<p>Now, the local cache has been updated with the module(s) you want to use in PowerShell Studio. Please notice that when you hover the mouse over the module name, the module version will be displayed.<\/p>\n<p style=\"background: white; margin: 0in 0in 7.5pt 0in;\"><a href=\"https:\/\/www.sapien.com\/blog\/wp-content\/uploads\/2017\/11\/PS2017_OB_Cache_02_2017-11-08_17-10-01.png\"><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-medium wp-image-14179\" src=\"https:\/\/www.sapien.com\/blog\/wp-content\/uploads\/2017\/11\/PS2017_OB_Cache_02_2017-11-08_17-10-01-233x300.png\" alt=\"\" width=\"233\" height=\"300\" srcset=\"https:\/\/dev.sapien.com\/blog\/wp-content\/uploads\/2017\/11\/PS2017_OB_Cache_02_2017-11-08_17-10-01-233x300.png 233w, https:\/\/dev.sapien.com\/blog\/wp-content\/uploads\/2017\/11\/PS2017_OB_Cache_02_2017-11-08_17-10-01.png 319w\" sizes=\"auto, (max-width: 233px) 100vw, 233px\" \/><\/a><\/p>\n<p>At this point, the selected module is available under the Object Browser section and can be easily added using the following steps:<\/p>\n<ol>\n<li>By drag-drop from the Object Browser.<br \/>\n<a href=\"https:\/\/www.sapien.com\/blog\/wp-content\/uploads\/2017\/11\/PS2017_OB_DragDrop_2017-11-08_23-13-40.png\"><img loading=\"lazy\" decoding=\"async\" class=\"alignnone wp-image-14180\" src=\"https:\/\/www.sapien.com\/blog\/wp-content\/uploads\/2017\/11\/PS2017_OB_DragDrop_2017-11-08_23-13-40-300x238.png\" alt=\"\" width=\"484\" height=\"384\" srcset=\"https:\/\/dev.sapien.com\/blog\/wp-content\/uploads\/2017\/11\/PS2017_OB_DragDrop_2017-11-08_23-13-40-300x238.png 300w, https:\/\/dev.sapien.com\/blog\/wp-content\/uploads\/2017\/11\/PS2017_OB_DragDrop_2017-11-08_23-13-40-768x609.png 768w, https:\/\/dev.sapien.com\/blog\/wp-content\/uploads\/2017\/11\/PS2017_OB_DragDrop_2017-11-08_23-13-40-848x673.png 848w, https:\/\/dev.sapien.com\/blog\/wp-content\/uploads\/2017\/11\/PS2017_OB_DragDrop_2017-11-08_23-13-40.png 982w\" sizes=\"auto, (max-width: 484px) 100vw, 484px\" \/><\/a><\/li>\n<li>Or, by just typing the command and the PrimalSense will response with a list of commands to choose.<br \/>\n<a href=\"https:\/\/www.sapien.com\/blog\/wp-content\/uploads\/2017\/11\/PS2017-TypingCommand_2017-11-08_23-16-59.png\"><img loading=\"lazy\" decoding=\"async\" class=\"alignnone wp-image-14181\" src=\"https:\/\/www.sapien.com\/blog\/wp-content\/uploads\/2017\/11\/PS2017-TypingCommand_2017-11-08_23-16-59-300x160.png\" alt=\"\" width=\"484\" height=\"258\" srcset=\"https:\/\/dev.sapien.com\/blog\/wp-content\/uploads\/2017\/11\/PS2017-TypingCommand_2017-11-08_23-16-59-300x160.png 300w, https:\/\/dev.sapien.com\/blog\/wp-content\/uploads\/2017\/11\/PS2017-TypingCommand_2017-11-08_23-16-59-768x411.png 768w, https:\/\/dev.sapien.com\/blog\/wp-content\/uploads\/2017\/11\/PS2017-TypingCommand_2017-11-08_23-16-59-1024x548.png 1024w, https:\/\/dev.sapien.com\/blog\/wp-content\/uploads\/2017\/11\/PS2017-TypingCommand_2017-11-08_23-16-59-848x454.png 848w, https:\/\/dev.sapien.com\/blog\/wp-content\/uploads\/2017\/11\/PS2017-TypingCommand_2017-11-08_23-16-59.png 1217w\" sizes=\"auto, (max-width: 484px) 100vw, 484px\" \/><\/a><\/li>\n<\/ol>\n<p>Notice, while working with the \u201c<strong>PowerShell Cache Editor<\/strong>\u201d, there&#8217;s no need to use the &#8220;<strong>Refresh Local Cache<\/strong>&#8220;.<\/p>\n<p>Just remember, when having multiple versions of the same module, make sure to use the latest one.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>One feature of PowerShell Studio that you want to pay attention to is the PowerShell Cache Editor.\u00a0When PowerShell Studio is opened for the first time, it creates a cache of all available cmdlets and modules that are on your local machine. The *cached cmdlets and modules are used to provide PrimalSense, syntax coloring for your [&hellip;]<\/p>\n","protected":false},"author":47,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_monsterinsights_skip_tracking":false,"_monsterinsights_sitenote_active":false,"_monsterinsights_sitenote_note":"","_monsterinsights_sitenote_category":0,"footnotes":""},"categories":[1143,703,303],"tags":[28,1080,1016,1188],"class_list":["post-14161","post","type-post","status-publish","format-standard","hentry","category-powershell","category-powershell-studio","category-tip","tag-powershell","tag-powershell-modules","tag-powershell-studio","tag-powershell-studio-2017"],"jetpack_featured_media_url":"","_links":{"self":[{"href":"https:\/\/dev.sapien.com\/blog\/wp-json\/wp\/v2\/posts\/14161","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/dev.sapien.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/dev.sapien.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/dev.sapien.com\/blog\/wp-json\/wp\/v2\/users\/47"}],"replies":[{"embeddable":true,"href":"https:\/\/dev.sapien.com\/blog\/wp-json\/wp\/v2\/comments?post=14161"}],"version-history":[{"count":16,"href":"https:\/\/dev.sapien.com\/blog\/wp-json\/wp\/v2\/posts\/14161\/revisions"}],"predecessor-version":[{"id":14255,"href":"https:\/\/dev.sapien.com\/blog\/wp-json\/wp\/v2\/posts\/14161\/revisions\/14255"}],"wp:attachment":[{"href":"https:\/\/dev.sapien.com\/blog\/wp-json\/wp\/v2\/media?parent=14161"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/dev.sapien.com\/blog\/wp-json\/wp\/v2\/categories?post=14161"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/dev.sapien.com\/blog\/wp-json\/wp\/v2\/tags?post=14161"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}