Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Windows PowerShell Import-module

On my computer in PowerShell the command

import-module GroupPolicy

fails with

import-module <<<<  GroupPolicy
+ CategoryInfo          : ResourceUnavailable: (GroupPolicy:String) [Import-Module],     FileNotFoundException
+ FullyQualifiedErrorId : Modules_ModuleNotFound,Microsoft.PowerShell.Commands.ImportModuleCommand

I cannot find a solution to this issue, according to Microsoft this is the way to go.

Background info:

A colleague developed a Windows PowerShell Script on his Windows 7 32 bit. He installed RSAT. The first command in this script is "import-module GroupPolicy". On his Win7x86 the command works fine, from the command line and when running the script as a whole.

I'm trying to work on his script but I'm using a Windows 7 64 bit system. I also installed RSAT (Windows6.1-KB958830-x64-RefreshPkg.msu). But on my machine the command fails like described above. I cannot find any important differences regarding the content of C:\Windows\System32\WindowsPowerShell\v1.0\Modules

Googling wasn't much help either. There were Postings about PowerShellV1 and running PowerShells x86 version on Win7x64, but neither helped solving this.

Help will be appreciated.

Regards, T.

like image 331
user1458620 Avatar asked Dec 31 '25 03:12

user1458620


1 Answers

You mention installing RSAT, but not enabling any of it's features. So I suspect you had not done anything in that regard...?

If that is the case, got to control panel -> programs and features -> turn windows features on or off:

enter image description here

I suspect enabling marked option should do the job...

like image 70
BartekB Avatar answered Jan 02 '26 16:01

BartekB



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!