Get-LocalGroup cmdlet Get-LocalGroup : The term 'Get-LocalGroup' is not recognized as the name of a cmdlet,

Viewed 17077

I know that Get-LocalGroup cmdlet is in the Microsoft.PowerShell.LocalAccounts module. I tried to import that module using the command

Get-Module Microsoft.Powershell.LocalAccounts

No error after the command is executed, but when I type Get-Module to see list of modules loaded into my current session, I don't see a module Microsoft.Powershell.LocalAccounts loaded.

Not sure what to do to load that module so that I can use the Get-LocalGroups cmdlet.

2 Answers

I'm finding that the x86 version of PowerShell is unable to see the LocalAccounts module.

The solution is to run the x64 version of PowerShell (which is the one marked with neither x86 nor x64).

You need to use Import-Module Microsoft.Powershell.LocalAccounts to import a module. Get-Module does not import modules.

PS C:\> Import-Module Microsoft.Powershell.LocalAccounts

PS C:\> Get-Module

ModuleType Version    Name                                ExportedCommands                                                                                                                                                     
---------- -------    ----                                ----------------                                                                                                                                                     
Script     1.0.0.0    ISE                                 {Get-IseSnippet, Import-IseSnippet, New-IseSnippet}                                                                                                                  
Binary     1.0.0.0    Microsoft.Powershell.LocalAccounts  {Add-LocalGroupMember, Disable-LocalUser, Enable-LocalUser, Get-LocalGroup...}                                                                                       
Manifest   3.1.0.0    Microsoft.PowerShell.Management     {Add-Computer, Add-Content, Checkpoint-Computer, Clear-Content...}                                                                                                   
Manifest   3.0.0.0    Microsoft.PowerShell.Security       {ConvertFrom-SecureString, ConvertTo-SecureString, Get-Acl, Get-AuthenticodeSignature...}                                                                            
Manifest   3.1.0.0    Microsoft.PowerShell.Utility        {Add-Member, Add-Type, Clear-Variable, Compare-Object...}                                                                                                            
Manifest   3.0.0.0    Microsoft.WSMan.Management          {Connect-WSMan, Disable-WSManCredSSP, Disconnect-WSMan, Enable-WSManCredSSP...}  
Related