PowerShell Tips: Managing Local Users and Groups

Windows Server 2016, when launched, will demand IT Professionals to become more proficient at utilizing PowerShell. While some have begun to dabble with the TechNet Script Repository, some are still a little frightened due to the perception that PowerShell is hard to learn let alone remember. PowerShell can be the great time saver if harnessed properly though. Let begin with an easy example.

Lets start with enabling the ability to manage Users and Groups locally and remotely in Windows Powershell.
 
Note: No download is required if you are currently running Windows 10 or currently have PowerShell 5 installed.

Open a PowerShell window in administrator mode and run the following Cmdlet to get the required management module.

FIND-Module localaccount | INSTALL-Module

A prompt may appear to download and install software / components required to access the Repository with the PowerShell modules.

If you download the module from Technet, the contents can be extracted to your personal PowerShell modules folder located typically under

%UserProfile%\Documents\WindowsPowerShell\Modules\

Once extracted, run the following Cmdlet to load up the module:

IMPORT-Module localaccount

A series of new and hopefully self explanatory cmdlets will appear once the module is imported. A listing of the current Cmdlets available are as follows:

Add-LocalGroupMember
Disable-LocalUser
Enable-LocalUser
Get-LocalGroup
Get-LocalGroupMember
Get-LocalUser
New-LocalGroup
New-LocalUser
Remove-LocalGroup
Remove-LocalGroupMember
Remove-LocalUser
Rename-LocalGroup
Rename-LocalUser

The module detailed above should operate in a PowerShell offering as low as Powershell 2.0.  So long as the desired systems can be managed via WMI remotely, you should be successful in managing older servers with this module.  However is is recommended to be running Windows 10 or currently have PowerShell 5 installed to reap the benefits offered.

Learn_PowerShell