您现在的位置是:网站首页> 编程资料编程资料

PowerShell添加本地账户脚本分享_PowerShell_

2023-05-26 325人已围观

简介 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")

-六神源码网