Simple and useful tool for creating timestamps in command line (batch). It need not fixed time format and is used current time zone.
Examples
for /f "tokens=1" %%a in ('timestamp.exe') do (
set timestamp=%%a
)
systeminfo > %timestamp%_%computername%.log
for /f "tokens=1-8 delims=- " %%a in ('timestamp.exe -d') do (
set year=%%a
set month=%%b
set day=%%c
set hour=%%d
set minute=%%e
set second=%%f
)
echo Now is %hour%:%minute%:%second% %month%-%day%-%year%
Download: timestamp.zip
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"
PS C:\> "XYZ\p107225" -cmatch "^[a-zA-Z]{2,3}\\p10[0-9]{4}$")
http://blogs.technet.com/b/technetczsk/archive/2010/02/15/serial-windows-powershell-ps-pro-programatory-cast-6.aspx
http://www.regular-expressions.info/