Exchange archives - The Multifunctioning DBA

The Multifunctioning DBA:

Exchange

Oct 21 2009   4:00PM GMT

Sprint HTC Hero



Posted by: Colin Smith
Android, Phone, Exchange

One reason that I was so excited to get this phone was that it supports Exchange Active Sync out of the box. This is great for me since I would like to consolidate down to one phone and get rid of my employer provided device that I am not so fond of. Well I was very disappointed when it did not work. I brought the Hero in and sat down with a mail administrator and we set it all up. Come to find out that the built in sync does not support ssl passwords. Well what is the point then? No IT department is going to allow device syncing without securing the password that is flying in the air in packets that could be sniffed out by anyone. This is, after all, my domain log in password and that is a huge security hole.Thank fully I found Touchdown by NitroDesk. This is a great application. I downloaded the trial installed it and off I went. Very simple setup and it just works and with PUSH email I get my email on the device quickly, sometimes before Outlook gets it. Synced my Calander and Contacts as well. Love it and I say it is well worth the $20.00 that the license costs. I got mine for $10.00 due to some special pricing that they had going on at the time. Check it out if you are on Android. It is great.

May 29 2009   9:58PM GMT

Exchange and Powershell



Posted by: Colin Smith
Exchange, Exchange Management, Powershell, Exchange Scripting, Scripting

I was just asked to take a look at writing a script for our new Exchange environment. Now I do not have a lot of experiance scripting for Exchange but I love a Powershell challenge. The problem was that all of our distribution groups had been set up with one option incorrect. I was asked if I could script a change for all groups. If not then this would take days, perhaps weeks to fix by clicking on every group and changing the option and saving.

I logged into the exchange server and started tooling around. I found that I could get a list of all the groups by doing a simple get-distribution group command as follows:

get-distributiongroup | select name

This gave me the names of all groups. I sent that to a flat file to use later. I then used the get-member command to find the option that I needed to modify. Then I was able to do a set-distributiongroup “name of group” -proertyname 0. That  command made the modification that we needed. After verifying that I wrote a foreach loop and I was done in less than 30 minutes. When I called our IT director back and let him know that it was complete he was shocked and very happy. Powershell can make you look very good to upper managment.

Let me know if you have anything that you need a script for.


Nov 14 2008   8:25PM GMT

Powershell – Get a list of Exchange Users



Posted by: Colin Smith
Microsoft Windows, Exchange, Powershell

In my last post I talked about using the Exchange Management Shell to get a list of users that needed to be placed into a group. Here is what we did. First we had to determine how we could find just the users that were of interest to us. We know that we had set two Custom Attributes on each of these users mailboxes so we decided to use that as a search filter. This is a pretty simple one liner but very effective and powerful.

 

Get-mailbox | where-object{$_.CustomAttribute15 –eq “some value”} | format-table Name | out-file “path to file”

 

So that looks at all mailboxes on the domain and will return only the names of the users whose mailboxes have CustomAttribute15 set to the value that we were looking for. Now that I have that list I am ready to move on to putting those users in the group. If I added the snap in for the Quest AD Command lets then I could have just used another | to that command and not even needed the file. We wanted that for records and to verify that the correct users were being modified. Again if you have any questions or comments about this please let me know by leaving them here or heading out to my website SysAdminSmtih.com and submitting a question to me.


Nov 5 2008   9:37PM GMT

Exchange Quota Management



Posted by: Colin Smith
Exchange, Powershell

One of our Mail Administrators is new to the world of Exchange as we are currently migrating from Lotus Notes. She is also new to the world of scripting but is eager to learn how to administer exchange using Powershell. I sat with her today and we walked through a simple example of how to set quotas for user mailboxes. Here is what we did:

 

$names = Import-Csv “path to csv file containing first and last names”

foreach($name in $names)

{

$first = $name.first

$last = $name.last

$identity = “$last, $first”

set-mailbox `”$identity`” -issuewarningquota 180mb

get-mailbox `”$identity`”

}

 

So let’s break this down a bit.

  1. I had the mail admin get a list of all the users and put them In a csv file with the headers of first, last
  2. We bring that in and assign the variables $first and $last
  3. I then create the $identity variable and assign that with $last, $first so it would look like ‘Smith, John’
    1. This is so we modify the correct mailbox
  4. Then I use the exchange commandlet set-mailbox and pass it the $identity variable and the parameters that I want to change.
    1. In this case only the issuewarningquota parameter is being modified.
  5. Then I do a get-mailbox for the same $identity and I pipe that to format-table and look at the name and the parameter that I just modified in order to make sure that it has been set correctly.

That is it. It is so easy to make these changes to a huge number of users. If you have any questions or comments please let me know. Also if you would like to drop me a line head over to http://sysadminsmith.com and submit a question.


Oct 22 2008   4:25PM GMT

Why Powershell?



Posted by: Colin Smith
Microsoft Windows, SQL Server, DBA, Exchange, Powershell

In my first few posts here I have done a lot of things in Windows Powershell. Some of you may be asking why Powershell and I am busy asking why not Powershell. Since being introduced to Powershell any time I hear a request to do just about anything in Windows I think about how I can script that using Powershell. My team thinks that I should get compensation from Microsoft since I bring it up so much. We all laugh about it but I really think that if you want to continue to grow with Microsoft products then you need to learn Powershell.

If you do not already know, Powershell is Microsoft’s new Shell Scripting Language. It is object oriented and has a pipe. The pipe is a great tool that UNIX users have enjoyed forever and now we all get to enjoy the power of the pipe. Powershell is made up of commandlets. These are the commands that you will use to do things with objects. They use a standard verb-noun syntax so it is easy to understand. An example of one of the commandlets is as follows. This is a very useful command as it will tell you what other commands are available to you.


PowerShellPlus 1.0.4.7
(C) 2007-2008 Scriptinternals. All Rights Reserved.

PowerTab version 0.99 Beta 2 PowerShell TabExpansion library
/\/\o\/\/ 2007 http://thePowerShellGuy.com
PowerTab Tabexpansion additions enabled : True
PS C:\Documents and Settings\smithc> Get-Command

CommandType     Name                                                                  Definition
———–     —-                                                                  ———-
Cmdlet          Add-Content                                                           Add-Content [-Path] <String[]> [-Value] <Object[]> [-PassThru] [-...
Cmdlet          Add-History                                                           Add-History [[-InputObject] <PSObject[]>] [-Passthru] [-Verbose] …
Cmdlet          Add-Member                                                            Add-Member [-MemberType] <PSMemberTypes> [-Name] <String> [[-Valu...
Cmdlet          Add-PSSnapin                                                          Add-PSSnapin [-Name] <String[]> [-PassThru] [-Verbose] [-Debug] [...
Cmdlet          Clear-Content                                                         Clear-Content [-Path] <String[]> [-Filter <String>] [-Include <St...
Cmdlet          Clear-Item                                                            Clear-Item [-Path] <String[]> [-Force] [-Filter <String>] [-Inclu...
Cmdlet          Clear-ItemProperty                                                    Clear-ItemProperty [-Path] <String[]> [-Name] <String> [-PassThru...
Cmdlet          Clear-Variable                                                        Clear-Variable [-Name] <String[]> [-Include <String[]>] [-Exclude...
Cmdlet          Compare-Object                                                        Compare-Object [-ReferenceObject] <PSObject[]> [-DifferenceObject...
Cmdlet          ConvertFrom-SecureString                                              ConvertFrom-SecureString [-SecureString] <SecureString> [[-Secure...
Cmdlet          Convert-Path                                                          Convert-Path [-Path] <String[]> [-Verbose] [-Debug] [-ErrorAction...
Cmdlet          ConvertTo-Html                                                        ConvertTo-Html [[-Property] <Object[]>] [-InputObject <PSObject>]…
Cmdlet          ConvertTo-SecureString                                                ConvertTo-SecureString [-String] <String> [[-SecureKey] <SecureSt…
Cmdlet          Copy-Item                                                             Copy-Item [-Path] <String[]> [[-Destination] <String>] [-Containe...
Cmdlet          Copy-ItemProperty                                                     Copy-ItemProperty [-Path] <String[]> [-Destination] <String> [-Na...
Cmdlet          Export-Alias                                                          Export-Alias [-Path] <String> [[-Name] <String[]>] [-PassThru] [-...
Cmdlet          Export-Clixml                                                         Export-Clixml [-Path] <String> [-Depth <Int32>] -InputObject <PSO…
Cmdlet          Export-Console                                                        Export-Console [[-Path] <String>] [-Force] [-NoClobber] [-Verbose...
Cmdlet          Export-Csv                                                            Export-Csv [-Path] <String> -InputObject <PSObject> [-Force] [-No...
Cmdlet          ForEach-Object                                                        ForEach-Object [-Process] <ScriptBlock[]> [-InputObject <PSObject...
Cmdlet          Format-Custom                                                         Format-Custom [[-Property] <Object[]>] [-Depth <Int32>] [-GroupBy...
Cmdlet          Format-List                                                           Format-List [[-Property] <Object[]>] [-GroupBy <Object>] [-View <...
Cmdlet          Format-Table                                                          Format-Table [[-Property] <Object[]>] [-AutoSize] [-HideTableHead...
Cmdlet          Format-Wide                                                           Format-Wide [[-Property] <Object>] [-AutoSize] [-Column <Int32>] …
Cmdlet          Get-Acl                                                               Get-Acl [[-Path] <String[]>] [-Audit] [-Filter <String>] [-Includ...
Cmdlet          Get-Alias                                                             Get-Alias [[-Name] <String[]>] [-Exclude <String[]>] [-Scope <Str...
Cmdlet          Get-AuthenticodeSignature                                             Get-AuthenticodeSignature [-FilePath] <String[]> [-Verbose] [-Deb...
Cmdlet          Get-ChildItem                                                         Get-ChildItem [[-Path] <String[]>] [[-Filter] <String>] [-Include...
Cmdlet          Get-Command                                                           Get-Command [[-ArgumentList] <Object[]>] [-Verb <String[]>] [-Nou...
Cmdlet          Get-Content                                                           Get-Content [-Path] <String[]> [-ReadCount <Int64>] [-TotalCount ...
Cmdlet          Get-Credential                                                        Get-Credential [-Credential] <PSCredential> [-Verbose] [-Debug] [...
Cmdlet          Get-Culture                                                           Get-Culture [-Verbose] [-Debug] [-ErrorAction <ActionPreference>]…
Cmdlet          Get-Date                                                              Get-Date [[-Date] <DateTime>] [-Year <Int32>] [-Month <Int32>] [-...
Cmdlet          Get-EventLog                                                          Get-EventLog [-LogName] <String> [-Newest <Int32>] [-Verbose] [-D...
Cmdlet          Get-ExecutionPolicy                                                   Get-ExecutionPolicy [-Verbose] [-Debug] [-ErrorAction <ActionPref...
Cmdlet          Get-Help                                                              Get-Help [[-Name] <String>] [-Category <String[]>] [-Component <S...
Cmdlet          Get-History                                                           Get-History [[-Id] <Int64[]>] [[-Count] <Int32>] [-Verbose] [-Deb...
Cmdlet          Get-Host                                                              Get-Host [-Verbose] [-Debug] [-ErrorAction <ActionPreference>] [-...
Cmdlet          Get-Item                                                              Get-Item [-Path] <String[]> [-Filter <String>] [-Include <String[...
Cmdlet          Get-ItemProperty                                                      Get-ItemProperty [-Path] <String[]> [[-Name] <String[]>] [-Filter...
Cmdlet          Get-Location                                                          Get-Location [-PSProvider <String[]>] [-PSDrive <String[]>] [-Ver...
Cmdlet          Get-Member                                                            Get-Member [[-Name] <String[]>] [-InputObject <PSObject>] [-Membe...
Cmdlet          Get-PfxCertificate                                                    Get-PfxCertificate [-FilePath] <String[]> [-Verbose] [-Debug] [-E...
Cmdlet          Get-Process                                                           Get-Process [[-Name] <String[]>] [-Verbose] [-Debug] [-ErrorActio...
Cmdlet          Get-PSDrive                                                           Get-PSDrive [[-Name] <String[]>] [-Scope <String>] [-PSProvider <...
Cmdlet          Get-PSProvider                                                        Get-PSProvider [[-PSProvider] <String[]>] [-Verbose] [-Debug] [-E...
Cmdlet          Get-PSSnapin                                                          Get-PSSnapin [[-Name] <String[]>] [-Registered] [-Verbose] [-Debu...
Cmdlet          Get-Service                                                           Get-Service [[-Name] <String[]>] [-Include <String[]>] [-Exclude ...
Cmdlet          Get-TraceSource                                                       Get-TraceSource [[-Name] <String[]>] [-Verbose] [-Debug] [-ErrorA...
Cmdlet          Get-UICulture                                                         Get-UICulture [-Verbose] [-Debug] [-ErrorAction <ActionPreference...
Cmdlet          Get-Unique                                                            Get-Unique [-InputObject <PSObject>] [-AsString] [-Verbose] [-Deb...
Cmdlet          Get-Variable                                                          Get-Variable [[-Name] <String[]>] [-ValueOnly] [-Include <String[...
Cmdlet          Get-WmiObject                                                         Get-WmiObject [-Class] <String> [[-Property] <String[]>] [-Filter...
Cmdlet          Group-Object                                                          Group-Object [[-Property] <Object[]>] [-NoElement] [-InputObject ...
Cmdlet          Import-Alias                                                          Import-Alias [-Path] <String> [-Scope <String>] [-PassThru] [-For...
Cmdlet          Import-Clixml                                                         Import-Clixml [-Path] <String[]> [-Verbose] [-Debug] [-ErrorActio...
Cmdlet          Import-Csv                                                            Import-Csv [-Path] <String[]> [-Verbose] [-Debug] [-ErrorAction <...
Cmdlet          Invoke-Expression                                                     Invoke-Expression [-Command] <String> [-Verbose] [-Debug] [-Error...
Cmdlet          Invoke-History                                                        Invoke-History [[-Id] <String>] [-Verbose] [-Debug] [-ErrorAction...
Cmdlet          Invoke-Item                                                           Invoke-Item [-Path] <String[]> [-Filter <String>] [-Include <Stri...
Cmdlet          Join-Path                                                             Join-Path [-Path] <String[]> [-ChildPath] <String> [-Resolve] [-C...
Cmdlet          Measure-Command                                                       Measure-Command [-Expression] <ScriptBlock> [-InputObject <PSObje...
Cmdlet          Measure-Object                                                        Measure-Object [[-Property] <String[]>] [-InputObject <PSObject>]…
Cmdlet          Move-Item                                                             Move-Item [-Path] <String[]> [[-Destination] <String>] [-Force] [...
Cmdlet          Move-ItemProperty                                                     Move-ItemProperty [-Path] <String[]> [-Destination] <String> [-Na...
Cmdlet          New-Alias                                                             New-Alias [-Name] <String> [-Value] <String> [-Description <Strin...
Cmdlet          New-Item                                                              New-Item [-Path] <String[]> [-ItemType <String>] [-Value <Object>...
Cmdlet          New-ItemProperty                                                      New-ItemProperty [-Path] <String[]> [-Name] <String> [-PropertyTy...
Cmdlet          New-Object                                                            New-Object [-TypeName] <String> [[-ArgumentList] <Object[]>] [-Ve...
Cmdlet          New-PSDrive                                                           New-PSDrive [-Name] <String> [-PSProvider] <String> [-Root] <Stri…
Cmdlet          New-Service                                                           New-Service [-Name] <String> [-BinaryPathName] <String> [-Display...
Cmdlet          New-TimeSpan                                                          New-TimeSpan [[-Start] <DateTime>] [[-End] <DateTime>] [-Verbose]…
Cmdlet          New-Variable                                                          New-Variable [-Name] <String> [[-Value] <Object>] [-Description <...
Cmdlet          Out-Default                                                           Out-Default [-InputObject <PSObject>] [-Verbose] [-Debug] [-Error...
Cmdlet          Out-File                                                              Out-File [-FilePath] <String> [[-Encoding] <String>] [-Append] [-...
Cmdlet          Out-Host                                                              Out-Host [-Paging] [-InputObject <PSObject>] [-Verbose] [-Debug] …
Cmdlet          Out-Null                                                              Out-Null [-InputObject <PSObject>] [-Verbose] [-Debug] [-ErrorAct...
Cmdlet          Out-Printer                                                           Out-Printer [[-Name] <String>] [-InputObject <PSObject>] [-Verbos...
Cmdlet          Out-String                                                            Out-String [-Stream] [-Width <Int32>] [-InputObject <PSObject>] [...
Cmdlet          Pop-Location                                                          Pop-Location [-PassThru] [-StackName <String>] [-Verbose] [-Debug...
Cmdlet          Push-Location                                                         Push-Location [[-Path] <String>] [-PassThru] [-StackName <String>...
Cmdlet          Read-Host                                                             Read-Host [[-Prompt] <Object>] [-AsSecureString] [-Verbose] [-Deb...
Cmdlet          Remove-Item                                                           Remove-Item [-Path] <String[]> [-Filter <String>] [-Include <Stri...
Cmdlet          Remove-ItemProperty                                                   Remove-ItemProperty [-Path] <String[]> [-Name] <String[]> [-Force...
Cmdlet          Remove-PSDrive                                                        Remove-PSDrive [-Name] <String[]> [-PSProvider <String[]>] [-Scop...
Cmdlet          Remove-PSSnapin                                                       Remove-PSSnapin [-Name] <String[]> [-PassThru] [-Verbose] [-Debug...
Cmdlet          Remove-Variable                                                       Remove-Variable [-Name] <String[]> [-Include <String[]>] [-Exclud...
Cmdlet          Rename-Item                                                           Rename-Item [-Path] <String> [-NewName] <String> [-Force] [-PassT...
Cmdlet          Rename-ItemProperty                                                   Rename-ItemProperty [-Path] <String> [-Name] <String> [-NewName] …
Cmdlet          Resolve-Path                                                          Resolve-Path [-Path] <String[]> [-Credential <PSCredential>] [-Ve...
Cmdlet          Restart-Service                                                       Restart-Service [-Name] <String[]> [-Force] [-PassThru] [-Include...
Cmdlet          Resume-Service                                                        Resume-Service [-Name] <String[]> [-PassThru] [-Include <String[]…
Cmdlet          Select-Object                                                         Select-Object [[-Property] <Object[]>] [-InputObject <PSObject>] …
Cmdlet          Select-String                                                         Select-String [-Pattern] <String[]> -InputObject <PSObject> [-Sim...
Cmdlet          Set-Acl                                                               Set-Acl [-Path] <String[]> [-AclObject] <ObjectSecurity> [-Passth...
Cmdlet          Set-Alias                                                             Set-Alias [-Name] <String> [-Value] <String> [-Description <Strin...
Cmdlet          Set-AuthenticodeSignature                                             Set-AuthenticodeSignature [-FilePath] <String[]> [-Certificate] <…
Cmdlet          Set-Content                                                           Set-Content [-Path] <String[]> [-Value] <Object[]> [-PassThru] [-...
Cmdlet          Set-Date                                                              Set-Date [-Date] <DateTime> [-DisplayHint <DisplayHintType>] [-Ve...
Cmdlet          Set-ExecutionPolicy                                                   Set-ExecutionPolicy [-ExecutionPolicy] <ExecutionPolicy> [-Verbos...
Cmdlet          Set-Item                                                              Set-Item [-Path] <String[]> [[-Value] <Object>] [-Force] [-PassTh...
Cmdlet          Set-ItemProperty                                                      Set-ItemProperty [-Path] <String[]> [-Name] <String> [-Value] <Ob…
Cmdlet          Set-Location                                                          Set-Location [[-Path] <String>] [-PassThru] [-Verbose] [-Debug] [...
Cmdlet          Set-PSDebug                                                           Set-PSDebug [-Trace <Int32>] [-Step] [-Strict] [-Verbose] [-Debug...
Cmdlet          Set-Service                                                           Set-Service [-Name] <String> [-DisplayName <String>] [-Descriptio...
Cmdlet          Set-TraceSource                                                       Set-TraceSource [-Name] <String[]> [[-Option] <PSTraceSourceOptio…
Cmdlet          Set-Variable                                                          Set-Variable [-Name] <String[]> [[-Value] <Object>] [-Include <St...
Cmdlet          Sort-Object                                                           Sort-Object [[-Property] <Object[]>] [-Descending] [-Unique] [-In...
Cmdlet          Split-Path                                                            Split-Path [-Path] <String[]> [-LiteralPath <String[]>] [-Parent]…
Cmdlet          Start-Service                                                         Start-Service [-Name] <String[]> [-PassThru] [-Include <String[]>…
Cmdlet          Start-Sleep                                                           Start-Sleep [-Seconds] <Int32> [-Verbose] [-Debug] [-ErrorAction ...
Cmdlet          Start-Transcript                                                      Start-Transcript [[-Path] <String>] [-Append] [-Force] [-NoClobbe...
Cmdlet          Stop-Process                                                          Stop-Process [-Id] <Int32[]> [-PassThru] [-Verbose] [-Debug] [-Er...
Cmdlet          Stop-Service                                                          Stop-Service [-Name] <String[]> [-Force] [-PassThru] [-Include <S...
Cmdlet          Stop-Transcript                                                       Stop-Transcript [-Verbose] [-Debug] [-ErrorAction <ActionPreferen...
Cmdlet          Suspend-Service                                                       Suspend-Service [-Name] <String[]> [-PassThru] [-Include <String[...
Cmdlet          Tee-Object                                                            Tee-Object [-FilePath] <String> [-InputObject <PSObject>] [-Verbo...
Cmdlet          Test-Path                                                             Test-Path [-Path] <String[]> [-Filter <String>] [-Include <String...
Cmdlet          Trace-Command                                                         Trace-Command [-Name] <String[]> [-Expression] <ScriptBlock> [[-O...
Cmdlet          Update-FormatData                                                     Update-FormatData [[-AppendPath] <String[]>] [-PrependPath <Strin...
Cmdlet          Update-TypeData                                                       Update-TypeData [[-AppendPath] <String[]>] [-PrependPath <String[...
Cmdlet          Where-Object                                                          Where-Object [-FilterScript] <ScriptBlock> [-InputObject <PSObjec...
Cmdlet          Write-Debug                                                           Write-Debug [-Message] <String> [-Verbose] [-Debug] [-ErrorAction...
Cmdlet          Write-Error                                                           Write-Error [-Message] <String> [-Category <ErrorCategory>] [-Err...
Cmdlet          Write-Host                                                            Write-Host [[-Object] <Object>] [-NoNewline] [-Separator <Object>...
Cmdlet          Write-Output                                                          Write-Output [-InputObject] <PSObject[]> [-Verbose] [-Debug] [-Er...
Cmdlet          Write-Progress                                                        Write-Progress [-Activity] <String> [-Status] <String> [[-Id] <In…
Cmdlet          Write-Verbose                                                         Write-Verbose [-Message] <String> [-Verbose] [-Debug] [-ErrorActi...
Cmdlet          Write-Warning                                                         Write-Warning [-Message] <String> [-Verbose] [-Debug] [-ErrorActi…

PS C:\Documents and Settings\smithc>


As you can see you have a lot of tools already built in after you install Powershell. Powershell is available from Microsoft as KB926139. I recommend going out and getting it and start learning how to use it.

Microsoft already has Powershell support built in to Exchange 2007, and SQL Server 2008. With Powershell you, as an administrator, can do more things using Powershell than you can with the GUI. Who would have ever thought that Microsoft would allow us to use a command line tool so efficiently? Since Microsoft has done this with these products I am sure that they will be continuing down this path. In fact with Server 2008 they have a core version that does not even have a GUI. I love it. Finally a light weight and very powerful OS and a great scripting tool to go along with it. In the future I expect to see more development of Powershell, version 2.0 is on the way, from Microsoft as well as third parties in order to get it to interface with other applications. Please take some time to explore and learn more about this great tool and I will have more on this topic in the future.

Thanks for reading this and I hope you learned something and I hope you are excited about Powershell like I am. Let me know if you have any questions by leaving a comment or go to sysadminsmith.com to drop me an email.