PowerShell添加本地账户脚本分享
程序员文章站
2022-03-14 07:58:24
脚本源码:
复制代码 代码如下:
$nt=[adsi]"winnt://localhost"
$user=$nt.create("user","test")
$us...
脚本源码:
复制代码 代码如下:
$nt=[adsi]"winnt://localhost"
$user=$nt.create("user","test")
$user.setpassword("password")
$user.setinfo()
get-wmiobject -class win32_useraccount -filter "name = 'test'" | set-wmiinstance -argument @{passwordexpires = 0}
$group=[adsi]"winnt://localhost/administrators,group"
$group.add("winnt://localhost/test")