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 LICENSE NUMBERS, ACTIVATION 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.
This topic is 4 years and 4 months old and has exceeded the time allowed for comments. Please begin a new topic or use the search feature to find a similar but newer topic.
ccs_devops
Posts: 2
Last visit: Fri Oct 18, 2019 8:00 am

Module Not Loading in Studio - ConfigurationManager

Post by ccs_devops »

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 3135 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: 1655
Last visit: Thu Mar 28, 2024 11:13 am
Answers: 39
Been upvoted: 30 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
SAPIEN Technologies, Inc.
ccs_devops
Posts: 2
Last visit: Fri Oct 18, 2019 8:00 am

Re: Module Not Loading in Studio - ConfigurationManager

Post by ccs_devops »

Yes the module loads as expected in the ISE:

ise_loading_module.JPG
ise_loading_module.JPG (51.36 KiB) Viewed 3121 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 3121 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: 8479
Last visit: Thu Mar 28, 2024 9:29 am
Answers: 19
Been upvoted: 37 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.
This topic is 4 years and 4 months old and has exceeded the time allowed for comments. Please begin a new topic or use the search feature to find a similar but newer topic.