PowerShell添加本地账户脚本分享

脚本源码:

复制代码 代码如下:

$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")

你可能感兴趣的:(PowerShell添加本地账户脚本分享)