PowerShell添加本地账户脚本分享
程序员文章站
2022-06-24 10:59:44
脚本源码:
复制代码 代码如下:
$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")