Exploring Local Account Management Cmdlets

PowerShell 5.1 (shipping with Windows 10 and Server 2016) can now natively manage local accounts. In the previous tip you learned how to use Get-LocalUser.

To explore other cmdlets for local account management, here is how you identify the module that exposes Get-LocalUser, and then list other cmdlets provided by that module:

#requires -Modules Microsoft.PowerShell.LocalAccounts

# find module that defines this cmdlet
$module = Get-Command -Name Get-LocalUser | Select-Object -ExpandProperty Source

# list all cmdlets defined by this module
Get-Command -Module $module

As it turns out, there is a whole bunch of new management cmdlets:

 
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
 

Twitter This Tip! ReTweet this Tip!