PowerShell: Create Local User Account

前端 未结 5 2062
情歌与酒
情歌与酒 2020-12-13 03:44

I need to create a new local user account, and then add them to the local Administrators group. Can this be done in PowerShell?

EDIT:



        
5条回答
  •  感动是毒
    2020-12-13 04:04

    Try using Carbon's Install-User and Add-GroupMember functions:

    Install-User -Username "User" -Description "LocalAdmin" -FullName "Local Admin by Powershell" -Password "Password01"
    Add-GroupMember -Name 'Administrators' -Member 'User'
    

    Disclaimer: I am the creator/maintainer of the Carbon project.

提交回复
热议问题