First, Bulk mobile computer
$computer =get-adcomputer-filter *-searchabase "computer ou" |select name
foreach ($i in $computer. Name) {dsquery computer-name $i |dsmove-newparent "New OU"}
Second, bulk disable account
Import-csv c:\xx.csv|foreach{disable-adacount-identity $_.name}
Third, use Move-adobject bulk mobile computer
1. Provide a list
$com =import-csv D:\com.csv
$com |foreach {get-adcomputer-identity $_.name} |select ObjectGUID |foreach {move-adobjec-identity $_. ObjectGUID-
TargetPath "Ou=it,dc=it581,dc=local"}
Four, batch open mailbox
Get-aduser-filter {name-like "test*"} |select name | Foreache {enable-mailbox-identity $_.name}
Five, the bulk mobile diabled computer
search-adaccount-accountdisabled-computersonly | Move-adobject-targetpath "Ou=discomputer,ou=it
, dc=inovance,dc=local "
Six
#设置初始密码
$password = "[Email protected]"
#输入登录名
$path = '. \users.txt '
Import-module ActiveDirectory
$usernames = Get-content-path $path
$secure _password = convertto-securestring-string $password-asplaintext-force
foreach ($username in $usernames) {
try{
set-adaccountpassword-identity $username-newpassword $secure _password
}
catch{
Write-host "' $ ($username) ' does not exist in AD, please check if the input is incorrect! "-foregroundcolor Red
}
}
CMD/C Pause
Seven, bulk mobile computer
$a = get-content D:\citrix_Ctrl_test.txt #存放计算机名的文本文件
foreach ($i in $a)
{
dsquery computer-name $i | Dsmove-newparent "ou=citrix_other,ou=servers,ou=citrix,dc=cicdev,dc=com" under #将计算机名移动到citrix_other OU
}
Eight, bulk set SMTP address
1, prepare a CSV file, you can have the name and MailAddress fields to
2, $user |%{set-mailbox-identity $_.name-emailaddress @{@=$_.mailaddress}}
This allows you to increase the SMTP address in bulk
This article is from the "Cary_qin blog" blog, make sure to keep this source http://xpqinqun.blog.51cto.com/2136/1974285
Some PowerShell instructions