PowerShell添加本地账户脚本分享

这篇文章主要介绍了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添加本地账户脚本分享的详细内容,更多请关注0133技术站其它相关文章!

赞(0) 打赏
未经允许不得转载:0133技术站首页 » 脚本专栏