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

14,308

Solution 1

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).

Solution 2

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...}  
Share:
14,308
Jason
Author by

Jason

Updated on June 05, 2022

Comments

  • Jason
    Jason almost 2 years

    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.