Is there windows user management cmdlets like AD cmdlets?

In Active Directory, we have cmdlets using which we can manage AD Users and Groups.The following link gives all the details of the AD cmdlets:

AD Cmdlets

Is there anything similar to AD cmdlets to manage windows local user accounts.?




  • Edited by cmm user Sunday, February 02, 2014 11:12 AM
January 31st, 2014 1:36pm

By default there is no powershell module built-in with Operating system to perform advance administration.

We have PS module where we can import them and perform local user account administration

http://blogs.technet.com/b/heyscriptingguy/archive/2011/07/02/use-a-free-powershell-module-to-work-with-local-accounts.aspx

Please find the below sample powershell command:

To create a new local user, a new local group, and add the local user to the local group, I use the following commands:

New-LocalUser -userName TESTUSER -password P@ssword1

New-LocalGroup -GroupName testgroup

Set-LocalGroup -userName testuser -GroupName testgroup add

If I need to remove a local user from a local group, I once again use the Set-Localgroup function:

Set-LocalGroup -userName testuser -GroupName testgroup remove

If I need to change a local user password, I use the Set-LocalUserPassword function. This will change local administrator passwords and service account passwords. The command and syntax are shown here:

Set-LocalUserPassword -userName testuser -password MyNewPassw@rd!

If I need to delete a local group, I use the Remove-LocalGroup function:

Remove-LocalGroup -GroupName testgroup

I can also delete local users by using the Remove-LocalUser command:

Remove-LocalUser testuser

Free Windows Admin Tool Kit Click here and download it now
January 31st, 2014 1:49pm

That module's probably your best bet. As mentioned there are no native cmdlets for local user admin, so if you wanted to do it without installing a module you'd need to use .Net ADSI calls within PowerShell as explained here http://www.petri.co.il/create-local-accounts-with-powershell.htm but that's far less user friendly.
January 31st, 2014 2:55pm

This topic is archived. No further replies will be accepted.

Other recent topics Other recent topics