MoveMailbox.ps1$UserFile = "users.txt"
$MyData = Import-Csv $UserFile -Delimiter ;
ForEach ($item in $MyData){
$UserIdentity = $($item.UserIdentity)
$TargetDatabase = $($item.TargetDatabase)
$BadTolerance = $($item.BadTolerance)
if ($UserIdentity -match "^*[a-z0-1]@domain.cz$") {
New-MoveRequest -Identity $UserIdentity -TargetDatabase $TargetDatabase -BadItemLimit $BadTolerance
} else {
Write-Host "Bad user login $UserIdentity!" -foregroundcolor "red"
}
}
users.txtUserIdentity;TargetDatabase;BadTolerance
user@domain.cz;exch10_db_1;10
Command to schedule:powershell -command ". 'C:\Program Files\Microsoft\Exchange Server\V14\bin\RemoteExchange.ps1'; Connect-ExchangeServer -auto; C:\Scripts\MoveMailbox.ps1"
adfind -b "dc=domena,dc=cz" -f "objectcategory=person" proxyAddresses -nodn | findstr /i "smtp" > emails.txt
http://www.joeware.net/freetools/tools/adfind/index.htm
Pomocí AdMod utility lze nastavit parametr „Hide from Exchange address lists“ ve vlastnostech profilu uživatele v AD (karta Exchange Advanced) dávkově.
admod -b cn="jan novak",ou=users,dc=domena,dc=cz "msExchHideFromAddressLists::TRUE"
např. pro všechny uživatele v kontejneru domena.cz –> users
for /f "tokens=1 delims=" %%a in ('dsquery user "ou=users,dc=domena,dc=cz" -limit 999 ^| findstr /i "CN="') do (
admod -b %%a "msExchHideFromAddressLists::TRUE" >> HideFromAddressLists.log
)