2/6/12

Remove default mailbox databases

Moving System Arbitration Mailboxes and removing the default dbs
To move the system arbitration mailboxes from the default databases to one of the DAG databases first find them and pipe to a new move request to DB1

Identify:
[PS] C:\Windows\system32>get-mailbox -Arbitration
Creating a new session for implicit remoting of "Get-Mailbox" command...

Name Alias ServerName ProhibitSendQuo
ta
---- ----- ---------- ---------------
SystemMailbox{1f05a927... SystemMailbox{1f0... ampf48-iqa1060 unlimited
SystemMailbox{e0dc1c29... SystemMailbox{e0d... ampf48-iqa1060 unlimited
FederatedEmail.4c1f4d8... FederatedEmail.4c... ampf48-iqa1060 1 MB (1,048,...

Migrate any normal mailboxes:
Get-MailboxDatabase | where{$_.name -like "*Mailbox Database*"} | get-mailbox | New-
MoveRequest -TargetDatabase db1


Migrate any arbitration mailboxes:
Get-MailboxDatabase | where{$_.name -like "*Mailbox Database*"} | get-mailbox -Arbitration | New-MoveRequest -TargetDatabase db1

Remove Default DB’s:
Get-MailboxDatabase | where{$_.name -like "*Mailbox Database*"} | get-mailbox

1/26/12

Quick Tip: Mailboxes created on...

get-mailbox | where {$_.WhenCreated -like "*1/26*"}

Addtionally, -and -or -not can be utilized as well as "*/1?/200?*" or "*1[0-3]/2012*".

1/4/12

Symantec DLP 11.1 and Exchange 2010 SP1

The send connector in Exchange 2010 SP1 will be configured with each DLP endpoint as a smart host. The authentication should be set to none. When using certificates to verify identity during a TLS sesson you will still se the Exchange send connector authentication to none.

Using the SMTP log on Exchange and DLP the certificate is exchanged during the TLS SMTP sesssion.

The DLP cert must be in the Exchange Root Trusted store
The Exchang hub selfsinged scerts must be in the DLP trusted store.

Workstations VLAN and ports for Joining and Functioning on domain.

UDP 88 Kerberos is needed, but do not forget with Win 7 and 2008 R2 DC's you need TCP 88 as well.

135,389,443,139 are needed.

UDP 389 is needed for joining the domain with Server 2008 R2 DC's

1025-5000 XP clients
42152-65535 Windows 7 clients

Addtionaly 123 NTP

12/21/11

Skip empty fields in CSV Import-CSV provision mailboxes Exchange 2010

I was working on a small program to provision mailboxes in a lab Enviroment using the import-csv cmd-let and a CSV file that was generated to meet a customers naming provision.

This particular naming provision requires Firstname M. Lastname. However, some accounts have no middle name meaning that there would be an uncessary whitespace in the Display Name.

To solve this I used an IF statement to vary my code during the conidtion of a CSV record having no middle name.


CSV File:
firstname,middle,lastname
Jonathan,M,Test
Jonathan2,,Test2


The key to this is using an IF statement on the CSV

if($_.csvfield){perform action with data in field} else {perform all actions without including any data from empty field}

The program using myorg.com domain FQDN and default "Users" OU:


$password = Read-Host "Enter password" -AsSecureString;
Import-Csv -Path C:\CSV\newtestaccounts.csv | ForEach-Object{
$_.firstname;
$firstNameTemp = $_.firstName;
$lastNameTemp = $_.lastname;
$middle = $_.middle;
if($_.middle)
{
$userPrin = $firstNameTemp.substring(0,1) + $middle + $lastNameTemp + "@myorg.com";
$displayName = $firstnameTemp + " " + $middle + "." + " " + $lastNameTemp;
$alias = $firstNameTemp.substring(0,1) + $middle + $lastNameTemp + "qa";

$userPrin = $userPrin.tolower()
$alias = $alias.tolower()

New-Mailbox -UserPrincipalName $userPrin -Alias $alias -Database "TempDB" -Name $displayName -OrganizationalUnit "myorg.com/Users" -Password $password -FirstName $firstName -LastName $lastName -DisplayName $displayName -ResetPasswordOnNextLogon $false
$alias
}
$userPrin = $firstNameTemp.substring(0,1)+ $lastNameTemp + "@myorg.com";
$displayName = $firstnameTemp + " " + $lastNameTemp;
$alias = $firstNameTemp.substring(0,1) + $lastNameTemp + "qa";

$userPrin = $userPrin.tolower()
$alias = $alias.tolower()

New-Mailbox -UserPrincipalName $userPrin -Alias $alias -Database "TempDB" -Name $displayName -OrganizationalUnit "myorg.com/Users" -Password $password -FirstName $firstName -LastName $lastName -DisplayName $displayName -ResetPasswordOnNextLogon $false
$alias

}

12/19/11

Creating some test mailboxes in Exchange 2010 SP1

[PS] C:\Windows\system32>$password = Read-Host -AsSecureString
********

[PS] C:\Windows\system32>for ($i = 1; $i -lt 11; $i++){$name = "MyOrg Test" +
$i; $lastname = "Test " + $i; $userp = $name + "@mydomain.com"; New-Mailbox -Nam
e $name -database "TempDB" -password $password -firstname "MyOrg" -lastname $
lastname -UserPrincipalName $userp}


A simple for loop used to create unquie names for test accounts to use during pre-production testing of the system.

I noticed that this creates the SAM name with spaces so using this .PS1 you can remove spaces from the SAM account name of a mailbox:


Function Remove-Spaces {
param($target)

begin {
filter Do-RemoveSpaces { $_ -replace " ", "" }
}

process { if($_) { $_ Do-RemoveSpaces } }

end { if($target) {$target Do-RemoveSpaces} }
}

for ($i = 1; $i -lt 11; $i++){

$mbx = "MyOrg*" + $i

$samtemp = Get-Mailbox where {$_.name -like $mbx}
$samtempname = $samtemp.SamAccountName

$samtempname = remove-spaces $samtempname

set-mailbox -identity $samtemp -samaccountname $samtempname


That is all for now...

9/9/11

Windows Admin Duties: automate reboot of the server

I needed to come up with a way to reboot the server over night on a one off occasion.

Well I already knew what to do, but I could not remember it so I am documenting this for later.

The following can be executed at the CMD prompt & the syntax below is exact.

at 1:00am cmd /c shutdown -r -t 120 /c "Server will shutdown in 2 min; use shutdown /a in the cmd prompt to stop this action" /f /d p:4:1

This cmd will /f force application shutdown & /c provide an event viewer comment & /d log an event into the event log that is p or planned and reason code 4 (application maintenance) & 1 (planned). Addtionally I am rebooting the server or shutdown -r(reboot) -t(time) 120 (seconds). I cannot run commands directly with at so I must have at load the CMD prompt or cmd & tell the CMD prompt to run a command once loaded /c.

Reason codes: http://ss64.com/nt/shutdown.html
Cmd ref on Tech-net: http://technet.microsoft.com/en-us/library/cc732503%28WS.10%29.aspx