Module Not Loading in Studio - ConfigurationManager

This forum can be browsed by the general public. Posting is limited to current SAPIEN license holders with active maintenance and does not offer a response time guarantee.
Forum rules
DO NOT POST SUBSCRIPTION NUMBERS, LICENSE KEYS OR ANY OTHER LICENSING INFORMATION IN THIS FORUM.
Only the original author and our tech personnel can reply to a topic that is created in this forum. If you find a topic that relates to an issue you are having, please create a new topic and reference the other in your post.

Any code longer than three lines should be added as code using the 'Select Code' dropdown menu or attached as a file.
ccs_devops
Posts: 2
Joined: Tue Jul 30, 2019 7:57 am

Module Not Loading in Studio - ConfigurationManager

Post by ccs_devops » Fri Oct 18, 2019 6:32 am

Product, version and build: PowerShell Studio 2019 / 5.6.167.0
32 or 64 bit version of product: 64
Operating system: Windows Server 2016 Std
32 or 64 bit OS: 64

Trying to load ConfigurationManager module into PowerShell Studio. I also have PowerShell Studio 2016 on a separate system and it works fine, loads the module, available in studio. When I attempt this in 2019, I get an error stating ResourceUnavailable. Added the path to the $env:PSModulePath (c:\Program Files (x86)\Microsoft Configuration Manager\AdminConsole\bin)
all users / hosts.
I successfully added the module to the cache via the editor and rebuilt the cache, without issue.

I have a simple script for testing this, test_load_modules.ps1;

Code: Select all

#Requires -Module ConfigurationManager
Get-Command -Module ConfigurationManager -Verb Get
Running the script through studio produces the following error:

Code: Select all

ERROR: C:\scripts\working\test_load_modules.ps1 : The script 'test_load_modules.ps1' cannot be run because the following modules that are specified by the
ERROR: "#requires" statements of the script are missing: ConfigurationManager.
line (1, 1): ERROR: At Line: 1 char: 1
ERROR: + C:\scripts\working\test_load_modules.ps1
ERROR: + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
ERROR:     + CategoryInfo          : ResourceUnavailable: (test_load_modules.ps1:String) [], ScriptRequiresException
ERROR:     + FullyQualifiedErrorId : ScriptRequiresMissingModules
ERROR:
pss2019_module_loading_error.jpg
pss2019_module_loading_error.jpg (113.07 KiB) Viewed 1906 times
The server is up to date, PowerShell Studio is up to date and as mentioned, I have PowerShell studio 2016 on another system and it loads the module without issue, the systems were essentially setup the same.

Any suggestions would be appreciated, thanks.

User avatar
brittneyr
Site Admin
Posts: 235
Joined: Thu Jun 01, 2017 7:20 am

Re: Module Not Loading in Studio - ConfigurationManager

Post by brittneyr » Fri Oct 18, 2019 7:29 am

It appears that it is not finding your module. If you use import-module with the path to the module, does it still fail?

Also, are you able to run your test script from the ISE?
Brittney Ryn
SAPIEN Technologies, Inc.

ccs_devops
Posts: 2
Joined: Tue Jul 30, 2019 7:57 am

Re: Module Not Loading in Studio - ConfigurationManager

Post by ccs_devops » Fri Oct 18, 2019 8:00 am

Yes the module loads as expected in the ISE:

ise_loading_module.JPG
ise_loading_module.JPG (51.36 KiB) Viewed 1892 times

Actually I am a bit embarrassed I didn't try this before posting but, it will load in Studio if the path to the module is explicitly defined:

pss2019_loading_module.JPG
pss2019_loading_module.JPG (52.24 KiB) Viewed 1892 times

Honestly, this works for my needs but, it still doesn't explain why this module cannot be referenced by name only, in Studio 2019.

I appreciate the response.

User avatar
Alexander Riedel
Posts: 7122
Joined: Tue May 29, 2007 4:43 pm

Re: Module Not Loading in Studio - ConfigurationManager

Post by Alexander Riedel » Mon Oct 28, 2019 5:42 pm

If you look at your ISE screenshot, you are runing it as administrator, elevated. As per your PowerShell Studio screenshot, you do not run the script elevated there.
So you have two different environments, access rights and potentially different PSModulePath settings.
Alexander Riedel
SAPIEN Technologies, Inc.