PowerShell: Create Local User Account

前端 未结 5 2061
情歌与酒
情歌与酒 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:13

    Import-Csv C:\test.csv |
    Foreach-Object {
      NET USER    $ _.username   $ _.password /ADD
      NET LOCALGROUP "group" $_.username  /ADD
    }
    

    edit csv as username,password and change "group" for your groupname

    :) worked on 2012 R2

提交回复
热议问题