Forum Discussion
Get-LocalGroupMember does not run remotely
- Dec 06, 2023
DamienFR68 It could be that the LocalAccounts module is not on the server. You could try to install it using Install-Module LocalAccounts. See also https://stackoverflow.com/questions/43989815/cant-find-microsoft-powershell-localaccounts-module-or-run-get-localuser, it could be (don't know what Server Operating System you have that the Windows Management Framework is not installed)
Please click Mark as Best Response & Like if my post helped you to solve your issue.
This will help others to find the correct solution easily. It also closes the item.
If one of the posts was helpful in other ways, please consider giving it a Like.
DamienFR68 It could be that the LocalAccounts module is not on the server. You could try to install it using Install-Module LocalAccounts. See also https://stackoverflow.com/questions/43989815/cant-find-microsoft-powershell-localaccounts-module-or-run-get-localuser, it could be (don't know what Server Operating System you have that the Windows Management Framework is not installed)
Please click Mark as Best Response & Like if my post helped you to solve your issue.
This will help others to find the correct solution easily. It also closes the item.
If one of the posts was helpful in other ways, please consider giving it a Like.
I have several windows server versions running, from 2008 R2 to 2022, with the same error on all.
I have tried using the Install-Module LocalAccounts command on one server (W2012R2) to check, but I get the exact same error message as the one I obtained when running my original script. Do you see what could explain that?
- Dec 07, 2023And Get-LocalGroupMember -Group Administrateurs | Where-Object { $_.PrincipalSource -eq "ActiveDirectory" does work on those machines interactively using powershell_ISE.exe of poweshell.exe?
- DamienFR68Dec 08, 2023Copper ContributorI have tried the command in PowerShell ISE (as admin) on one of the servers, still the same error message.
- Dec 08, 2023Ok, so if you do Install-Module Microsoft.PowerShell.LocalAccounts , does it work then?
C:\Users\HarmVeenstra> get-command -Module Microsoft.PowerShell.LocalAccounts
CommandType Name Version Source
----------- ---- ------- ------
Cmdlet Add-LocalGroupMember 1.0.0.0 Microsoft.PowerShell.LocalAccounts
Cmdlet Disable-LocalUser 1.0.0.0 Microsoft.PowerShell.LocalAccounts
Cmdlet Enable-LocalUser 1.0.0.0 Microsoft.PowerShell.LocalAccounts
Cmdlet Get-LocalGroup 1.0.0.0 Microsoft.PowerShell.LocalAccounts
Cmdlet Get-LocalGroupMember 1.0.0.0 Microsoft.PowerShell.LocalAccounts
Cmdlet Get-LocalUser 1.0.0.0 Microsoft.PowerShell.LocalAccounts
Cmdlet New-LocalGroup 1.0.0.0 Microsoft.PowerShell.LocalAccounts
Cmdlet New-LocalUser 1.0.0.0 Microsoft.PowerShell.LocalAccounts
Cmdlet Remove-LocalGroup 1.0.0.0 Microsoft.PowerShell.LocalAccounts
Cmdlet Remove-LocalGroupMember 1.0.0.0 Microsoft.PowerShell.LocalAccounts
Cmdlet Remove-LocalUser 1.0.0.0 Microsoft.PowerShell.LocalAccounts
Cmdlet Rename-LocalGroup 1.0.0.0 Microsoft.PowerShell.LocalAccounts
Cmdlet Rename-LocalUser 1.0.0.0 Microsoft.PowerShell.LocalAccounts
Cmdlet Set-LocalGroup 1.0.0.0 Microsoft.PowerShell.LocalAccounts
Cmdlet Set-LocalUser 1.0.0.0 Microsoft.PowerShell.LocalAccounts