How to install GroupPolicy module for PowerShell?
Asked Answered
K

3

6

I just started writing scripts in PowerShell.
The desired script is supposed to create a local GroupPolicyObject (GPO) which will be specified afterwards. Research showed that it could be done with the New-GPO command within the GroupPolicy module for PowerShell. I tried to install the mentioned module but unfortunately nothing I found worked. May I ask for help?

I am using Windows 7 and Powershell 5.1.14409.1005

Error I receive when running example from Microsoft page (New-GPO -Name TestGPO -Comment "This is a test GPO."): Error when running (New-GPO -Name TestGPO -Comment "This is a test GPO.") - example provided by Microsoft

Kalgan answered 15/1, 2019 at 7:20 Comment(1)
On Win7 you need to add Group Policy Management Tools under RSAT (check this blog post) – Weft
C
0

Step 1. Install RSAT from Microsoft site:

https://www.microsoft.com/en-in/download/details.aspx?id=7887

Step 2. Enable Group Policy from Windows Features.

Following link describes the steps in details:

https://www.powershellmagazine.com/2012/05/14/managing-group-policy-with-powershell

Cryptozoite answered 15/1, 2019 at 7:20 Comment(1)
First link is 404. – Chablis
B
5

It is actually extremely simple, but the organization of the modules and features has changed many times in the past ten years, Microsoft Docs don't document the up-to-date way anywhere and all articles found online are very old.

Anyway, to install the Powershell Module called GroupPolicy, you need to install the Windows Feature called GPMC (Group Policy Management Console) which includes the mentioned module.

Install-WindowsFeature GPMC

This feature was once a subfeature of the RSAT feature, which is the cause of confusion.

Bleier answered 20/4, 2022 at 16:26 Comment(1)
How to install Install-WindowsFeature though? πŸ€” – Highcolored
C
0

Step 1. Install RSAT from Microsoft site:

https://www.microsoft.com/en-in/download/details.aspx?id=7887

Step 2. Enable Group Policy from Windows Features.

Following link describes the steps in details:

https://www.powershellmagazine.com/2012/05/14/managing-group-policy-with-powershell

Cryptozoite answered 15/1, 2019 at 7:20 Comment(1)
First link is 404. – Chablis
T
0

Have you installed the RSAT (Remote Server Administration Tools) Group Policy component?

Tablet answered 15/1, 2019 at 7:29 Comment(3)
Yes, I just checked. I did. – Kalgan
Get-Module -ListAvailable – Tablet
It does not appear when running "Get-Module -ListAvailable" but I downloaded it from Microsoft. When trying to reinstall it it just says that it was already installed. I installed (KB958830). – Kalgan

© 2022 - 2024 β€” McMap. All rights reserved.