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
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.
Posts: 2
Last visit: Wed Dec 31, 1969 4:00 pm

Module Not Loading in Studio - ConfigurationManager

Post by ccs_devops »

Product, version and build: PowerShell Studio 2019 /
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
pss2019_module_loading_error.jpg (113.07 KiB) Viewed 2815 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
Site Admin
Posts: 818
Last visit: Fri Jul 30, 2021 12:06 pm
Answers: 16
Been upvoted: 13 times

Re: Module Not Loading in Studio - ConfigurationManager

Post by brittneyr »

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.

Posts: 2
Last visit: Wed Dec 31, 1969 4:00 pm

Re: Module Not Loading in Studio - ConfigurationManager

Post by ccs_devops »

Yes the module loads as expected in the ISE:

ise_loading_module.JPG (51.36 KiB) Viewed 2801 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 (52.24 KiB) Viewed 2801 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: 7718
Last visit: Fri Jul 30, 2021 12:49 pm
Answers: 4
Been upvoted: 10 times

Re: Module Not Loading in Studio - ConfigurationManager

Post by Alexander Riedel »

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.