ex 2010 sp1 powershell v2 Set-EWSOofSettings not recognised? setting Out of Office Via Shell

awilderbeast
awilderbeast used Ask the Experts™
on
Hi all,

as the title suggests

im on exchange 2010 SP1 and am trying to set an out of office via shell (shell version 2) and the command Get-EWSOofSettings is not recognisezed and according to the blog where i found the command it should work on shell v2

http://www.mikepfeiffer.net/2010/07/manage-exchange-2007-out-of-office-oof-settings-with-powershell-and-the-ews-managed-api/
http://blogs.ezetraining.co.uk/Blog/GarethJones/Lists/Posts/Post.aspx?ID=21

anyone help me out?
Thanks
Comment
Watch Question

Do more with

Expert Office
EXPERT OFFICE® is a registered trademark of EXPERTS EXCHANGE®
That will only work if you have the Exchange 2010 powershell snapin installed. It would probably work on your Exchange box but to run it elsewhere you need to install the Microsoft Exchange Server 2010 Management Tools.
To see how to install the tools on the machine you are running PowerShell on see below.

http://technet.microsoft.com/en-us/library/bb232090.aspx

Author

Commented:
im running it on the exchange box :|

i thought i might of needed the exchange web api installed that on the exchange box and still no go :|
How to Generate Services Revenue the Easiest Way

This Tuesday! Learn key insights about modern cyber protection services & gain practical strategies to skyrocket business:

- What it takes to build a cloud service portfolio
- How to determine which services will help your unique business grow
- Various use-cases and examples

Can you confirm that the Management Tools are installed?
This code assumes the EWS Managed API assembly is located in c:\bin; update the path as needed for your machine. This function is designed to return information similar to the Get-MailboxAutoReplyConfiguration cmdlet in Exchange 2010, here is the code:

 
function Get-EWSOofSettings {
    [CmdletBinding()]
    param(
        [Parameter(Position=0, ValueFromPipelineByPropertyName=$true, Mandatory=$true)]
        [System.String]
        [Alias("Identity")]
        $PrimarySmtpAddress,
        [Parameter(Position=1, Mandatory=$false)]
        [System.String]
        $ver = "Exchange2007_SP1"
        )

Open in new window


Once you have the mailbox permissions worked out and have added the function to your PowerShell session, you can test out the code. The following example shows how you would run the function:

 
Get-EWSOofSettings -Identity David

Open in new window

See the following for the correct way to get into the Exchange Management Shell

http://technet.microsoft.com/en-us/library/dd638134.aspx
Top Expert 2011
Commented:
As the first link you provided stated, you need to install ews managed api and do some permissions settings noticed in the same document

After that you need to load the Get-EWSOofSettings function, you could copy the complete function and paste it with the exchange managament shell, after that you must be able to run the Get-EWSOofSettings comdlet

Author

Commented:
ok i should of read that first article a bit more!
but i read the second one first and found the error in the first one but never read it, if you get me

anyway, how do i add the Get-EWSOofSettings function to my powershell session?

thanks
You would put this code at the top of your script (or at least above where you call the function). If you aren't using a script then you can add the function to all powershell sessions by adding it to your powershell profile. The profile is launched each time powershell runs. See here for understanding of profiles - http://msdn.microsoft.com/en-us/library/bb613488%28v=vs.85%29.aspx

function Get-EWSOofSettings {
    [CmdletBinding()]
    param(
        [Parameter(Position=0, ValueFromPipelineByPropertyName=$true, Mandatory=$true)]
        [System.String]
        [Alias("Identity")]
        $PrimarySmtpAddress,
        [Parameter(Position=1, Mandatory=$false)]
        [System.String]
        $ver = "Exchange2007_SP1"
        )

Open in new window

Author

Commented:
thanks

Do more with

Expert Office
Submit tech questions to Ask the Experts™ at any time to receive solutions, advice, and new ideas from leading industry professionals.

Start 7-Day Free Trial