Home > Exchange Server, PowerShell > Module: ExchangeServices – Functions to stop/start/query Exchange services

Module: ExchangeServices – Functions to stop/start/query Exchange services

Description

Exchange 2013 logo 128x128Being someone who’s converted from Exchange to Lync, I have the luxury of cmdlets for managing Lync services. This includes starting, stopping, and querying those services. I’ve heard from a few Exchange guys who have said it would be nice if the Exchange guys had the same ability. Sure, you can manually type a PowerShell query each time, but why not convert that into some functions? I’ve created a module that has three functions in it. Start-ExWindowsService, which will start any Exchange service that is not disabled and not currently running. Stop-ExWindowsService will stop all running Exchange services. Get-ExWindowsService, which will display all Exchange services and their status and startup type. And finally, Set-ExWindowsServiceRecoveryOptions sets all Exchange related services to automatically restart in the event of a service failure.

 

Syntax

Start-ExWindowsService [[-ComputerName] ] [[-Name] ] [-WhatIf] [-Confirm] []
Stop-ExWindowsService [[-ComputerName] ] [[-Name] ] [-Force] [-WhatIf] [-Confirm] []
Get-ExWindowsService [[-ComputerName] ] [[-Name] ] [-WhatIf] [-Confirm ] []
Set-ExWindowsServiceRecoveryOptions [[-ComputerName] ] [-WhatIf] [-Confirm]

Installation

Open PowerShell and type $env:PSModulePath. Note that it will generally include two paths. One is to c:\Windows\System32\WindowsPowerShell\v1.0\Modules\. Placing the module in this location will make it available to everyone who uses that computer. The other path is to a subfolder of your My Documents folder. Something like C:\Users\administrator\Documents\WindowsPowerShell\Modules. Placing the module in there will make it available just to you. In either case, unzip the contents of the zip file, including the folder, to the modules folder. One thing to note: if you place the module in your personal modules folder, it will not show in the list when you run Get-Module -ListAvailable. But it will still work fine. Import the module by typing Import-Module ExchangeServices

Download

v1.1 – 01-26-2015 – ExchangeServices.v1.1.zip

v1.0 – 04-01-2014 – ExchangeServices.v1.0.zip

Changelog

See the changelog for information on what’s changed/included in each version.

 

Categories: Exchange Server, PowerShell Tags:
  1. Red
    July 1st, 2015 at 08:19 | #1

    At C:\WINDOWS\system32\WindowsPowerShell\v1.0\Modules\ExchangeServices\ExchangeServices.psm1:92 char:12
    + #Requires -Version 3.0
    + ~~~~~~~~
    Cannot bind parameter because parameter ‘version’ is specified more than once. To provide multiple values to
    parameters that can accept multiple values, use the array syntax. For example, “-parameter value1,value2,value3”.
    + CategoryInfo : ParserError: (:) [], ParentContainsErrorRecordException
    + FullyQualifiedErrorId : ParameterAlreadyBound

    Import-Module : The module to process ‘ExchangeServices’, listed in field ‘ModuleToProcess/RootModule’ of module
    manifest ‘C:\WINDOWS\system32\WindowsPowerShell\v1.0\Modules\ExchangeServices\ExchangeServices.psd1’ was not processed
    because no valid module was found in any module directory.
    At line:1 char:1
    + Import-Module ExchangeServices
    + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo : ResourceUnavailable: (ExchangeServices:String) [Import-Module], PSInvalidOperationExcept
    ion
    + FullyQualifiedErrorId : Modules_ModuleFileNotFound,Microsoft.PowerShell.Commands.ImportModuleCommand

  1. April 6th, 2014 at 01:56 | #1
  2. April 6th, 2014 at 02:03 | #2