# Missing Something with "Get-Module"

**URL:** <https://forums.powershell.org/t/missing-something-with-get-module/24277>\
**Category:** PowerShell Help\
**Created:** [June 13, 2024, 6:21pm UTC](https://forums.powershell.org/t/missing-something-with-get-module/24277 "2024-06-13T18:21:22Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![dalebert](https://avatars.discourse-cdn.com/v4/letter/d/f17d59/32.png) [@dalebert](https://forums.powershell.org/u/dalebert)\
**Post date:** [June 13, 2024, 6:21pm UTC](https://forums.powershell.org/t/missing-something-with-get-module/24277/1 "2024-06-13T18:21:22Z")

</div>

Hi, All.

I’m writing this script. The first section of the script is to check and make sure the required modules are loaded in the session to run the different commands. I know I’m missing something small on this but I can’t get the script to find the GroupPolicy module like the rest of the modules. Here’s a screenshot of what I mean from VS Code:

 ![ModCheck](https://us1.discourse-cdn.com/flex019/uploads/powershell/original/2X/8/8fa09d64d9f6b69d2f03ce9d469222d6bdd50b64.jpeg)

I’m not sure why, but the script will find all the modules except GroupPolicy. But in a separate sessions I can see it, import it… whatever.

 ![GP](https://us1.discourse-cdn.com/flex019/uploads/powershell/original/2X/0/057268eb2c2450efd18b94fa4c2872a8e77f02f9.jpeg)

What am I missing?

Thanks,  
Dale

---

<div class="post-metadata">

**Author:** ![grey0ut](https://sea1.discourse-cdn.com/flex019/user_avatar/forums.powershell.org/grey0ut/32/5310_2.png) [@grey0ut](https://forums.powershell.org/u/grey0ut)\
**Post date:** [June 13, 2024, 8:14pm UTC](https://forums.powershell.org/t/missing-something-with-get-module/24277/2 "2024-06-13T20:14:40Z")

</div>

What’s the actual output of that particular Get-Module instance from the script? Maybe as a test instead of capturing it in a variable just dump it do console and add the -Verbose parameter too?

You may also look at the [Requires](https://ss64.com/ps/syntax-requires.html) statement as an option.

---

<div class="post-metadata">

**Author:** ![dalebert](https://avatars.discourse-cdn.com/v4/letter/d/f17d59/32.png) [@dalebert](https://forums.powershell.org/u/dalebert)\
**Post date:** [June 14, 2024, 6:35pm UTC](https://forums.powershell.org/t/missing-something-with-get-module/24277/3 "2024-06-14T18:35:49Z")

</div>

Looks like I have fallen victim to versioning. When I run the script in VS Code, it’s running everything in PS 7.3.9. If I launch a terminal window from within VS Code, it opens PS 5. I have everything already setup for 5, but not 7. Which is why I was getting the missing module stuffs.

So, thanks for the reply. Hope this makes sense…

---

<div class="post-metadata">

**Author:** ![grey0ut](https://sea1.discourse-cdn.com/flex019/user_avatar/forums.powershell.org/grey0ut/32/5310_2.png) [@grey0ut](https://forums.powershell.org/u/grey0ut)\
**Post date:** [June 14, 2024, 8:05pm UTC](https://forums.powershell.org/t/missing-something-with-get-module/24277/4 "2024-06-14T20:05:50Z")

</div>

yeah I think i’m tracking. I’m glad you figured it out, cause that kinda stuff drives me crazy.  
It’s still worth taking a look at that Requires statement that I linked. I’ve used that in several of my scripts to replace long sanity check areas, and as far as I know it’s backwards compatible to at least v3.  
Sometimes I still manually check for modules if I want to do something custom upon failure like write a pretty message to the console, or log the reason why the script exited to a file.

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/flex019/uploads/powershell/original/1X/385e4f9fe133561ad30a814262fe0e0ae6bc3ef0.png) [@system](https://forums.powershell.org/u/system)\
**Post date:** [July 14, 2024, 8:06pm UTC](https://forums.powershell.org/t/missing-something-with-get-module/24277/5 "2024-07-14T20:06:21Z")

</div>

Closed on July 14, 2024, 8:06pm UTC

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.
