我正在尝试使用 Get-GPO PowerShell 模块。因此我首先安装了 RSAT,但仍然缺少 GroupPolicy 模块:
PS C:\Users\admin\Desktop> Install-WindowsFeature RSAT
Success Restart Needed Exit Code Feature Result
------- -------------- --------- --------------
True No NoChangeNeeded {}
PS C:\Users\admin\Desktop> Import-Module grouppolicy
Import-Module : The specified module 'grouppolicy' was not loaded because no valid module file was found in any module
directory.
At line:1 char:1
+ Import-Module grouppolicy
+ ~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : ResourceUnavailable: (grouppolicy:String) [Import-Module], FileNotFoundException
+ FullyQualifiedErrorId : Modules_ModuleNotFound,Microsoft.PowerShell.Commands.ImportModuleCommand
PS C:\Users\admin\Desktop>
如何安装 GroupPolicy 模块?
答案1
您已经非常接近了。组策略工具曾经作为 RSAT 的子集安装,我相信一些文档仍然这样说。
只需运行Install-WindowsFeature GPMC
,您就会获得安装的组策略管理控制台和组策略 PowerShell 模块。