MVP - Most Valuable Professional
rss

Just can't get enough of IT

This blog is about mostly anything in IT. But the primary focuses are Microsoft Technologies like Exchange, Office 365, Azure and Cloud Security.

Problem

When you install the Exchange Server Security Update KB 3087126 on a server running the Exchange Server 2013 management tools only, you might receive an error message when starting the Exchange Management Shell.

The error might look like this:

PowerShell Error KB3087126

The error message indicates that WinRM is having issues.This is not the case.

The problem occues due to registry changes performed by the patch setup and due to the way how ConnectFunctions.ps1 (used by RemoteExchange.ps1) determines the Exchange Server to connect to.

The script tries to connect to the local FQDN, if any Exchange role is installed on the local server. This is determined by querying the registry using the following command:

if (@(get-item HKLM:\SOFTWARE\Microsoft\ExchangeServer\v15\*role -erroraction:silentlycontinue).length -gt 0)

The queried registry does not exist prior to installation of KB 3087126.

Regustry Keyy added by KB3087126 on a Management Tools only server

Solution

When having installed the Exchange Server 2013 management tools only, which might be the case on a monitoring or scheduled task server, do the following:

  • Delete the registry key ClientAccessRole
  • Open a new Exchange Power Shell session

Enjoy the Exchange Management Shell.

Links

 


Mailscape 365 - Hybrid Exchange & Office 365 Monitoring and Reporting
Many organizations are choosing to use a mix of on-premise Microsoft Exchange and hosted Office 365 to meet their staff needs. These deployments, however, are challenging to support, with several 'moving parts' that need to be monitored in order to ensure reliable messaging and calendaring services - Test Drive Mailscape for Exchange Online

 

Read More »

A new PowerShell script to add multiple legacy public folder replicas has been published to TechNet Gallery and Github

The script supports public folder migration during migration phases when upgrading to a new version of Exchange. Depending on the timespan for a migration project and the internal requirements of public folder replication, you might need a different apporach to add legacy public folder replicas.

Add replicas for SERVER01, SERVER02 to all sub folders of \COMMUNICATIONS\PR

 .\Add-PFReplica.ps1 -ServersToAdd SERVER01,SERVER02 -PublicFolderServer SERVER01 -TopPublicFolder "\COMMUNICATIONS\PR"

 

Note

The script is intended to work with legacy public folders on Exchange Server 2007 and Exchange Server 2010.

Links

 


Mailscape 365 - Hybrid Exchange & Office 365 Monitoring and Reporting
Many organizations are choosing to use a mix of on-premise Microsoft Exchange and hosted Office 365 to meet their staff needs. These deployments, however, are challenging to support, with several 'moving parts' that need to be monitored in order to ensure reliable messaging and calendaring services - Test Drive Mailscape for Exchange Online

Read More »

The community script Copy-ReceiveConnector has been updated. Receive Connectors that do exist on a specified target server can now be updated.

Besides the receive connector communication the assigned permissions of the source connector can be copied as well.
 

Links

 


Are you unsure, if you should migrate to Office 365? You want to know more about security of cloud applications and services? Your Exchange Server infrastructure requires an upgrade? Contact me via email: thomas@mcsmemail.de

Read More »

A new community PowerShell script to simplify Exchange Server mailbox migrations has been published to TechNet Gallery and Github.

Features

  • Validate CSV file for required column EmailAddress prior to creating migration batch in Exchange
  • Automatic batch naming based on CSV file name
  • Common notification email address settings
  • Variable AutoComplete of batches
  • Common logging of script activities

See script help for examples.

Links

 


Checkout the professional services provided by Granikos for planning and migration your exisiting Exchange Server infrastructure to the cloud. Protect your cloud services using the CloudSOC™ technology provided by Elastica.

Read More »
On July 4, 2015
4978 Views
Last Updated: 2017-08-19

Exchange Server 2013Exchange Server 2016Description

PowerShell module providing centralizied logging and other helpful functions.

Examples

Import-Module GlobalFunctions 
$ScriptDir = Split-Path $script:MyInvocation.MyCommand.Path 
$ScriptName = $MyInvocation.MyCommand.Name 

# Create a new logger object, keeping the last 14 days of log files
$logger = New-Logger -ScriptRoot $ScriptDir -ScriptName $ScriptName -LogFileRetention 14 

# Write a new informational message to the log file  
$logger.Write('My Log Message')

# Write an error message to the log file
$logger.Write('My custom error message')

# Write a warning message to the log file
$logger.Write('My custom warning')

# Send a log file by email at the end of your script
$logger.SendLogFile('sender@mcsmemail.de', 'recipient@mcsmemail.de', 'smtpserver.mcsmemail.de')

How to install a PowerShell Module

You can "install" a PowerShell module by copying the module to a sub folder of the same name as the module in either of the two following locations:

  • Default PowerShell module path define by PSModulePath variable ($env:PSModulePath)
  • Custom PowerShell module path, which requires the full path to be added to the PSModulePath system variable

Default PowerShell Module Path

  1. Open a new PowerShell window and query the content of PSModulePath variable
    PS C:\> $env:PSModulePath
    C:\Users\admin\Documents\WindowsPowerShell\Modules;C:\Program Files\WindowsPowerShell\Modules;C:\WINDOWS\sys
    tem32\WindowsPowerShell\v1.0\Modules

     

  2. Create a new folder named GlobalFunctions in C:\Program Files\WindowsPowerShell\Modules

  3. Copy the GlobalFunctions.psm1 file to C:\Program Files\WindowsPowerShell\Modules\GlobalFunctions

That's it.

Custom PowerShell Module Path

These steps assume that you use a dedicated PowerShell scripts folder, e.g. D:\MyScripts

  1. Create a new folder named MyModules in D:\MyScripts
    -> D:\MyScripts\MyModules
  2. Create a new folder named GlobalFunctions in D:\MyScripts\MyModules
    -> D:\MyScripts\MyMOdules\GlobalFunctions
  3. Copy the GlobalFunctions.psm1 file to D:\MyScripts\MyModules\GlobalFunctions
  4. Add the full file path D:\MyScripts\MyModules to the system variable PSModulePath
    You can use Set-PersistentPSModulePath.ps1 script, provided here. Just copy the script to D:\MyScripts\MyModules 
    .\Set-PersistentPSModulePath.ps1 -Add

Close the current PowerShell window and open a new PowerShell window. That's it.

PowerShell 5

When using PowerShell 5, you can simply use the following PowerShell command from within an administrative PowerShell window.

Install-Module GlobalFunctions

When a new version of the GlobalFunctions module has been released, use the following PowerShell command to update the module.

Update-Module GlobalFunctions

That's it.

Version History

  • 1.0 Initial release
  • 1.1 Write to Event log added, send log file added
  • 1.2 CopyFile added
  • 1.3 Updated for PowerShellGallery
  • 2.0 Converted to UNICODE, Functions added: Replace-SpecialCharactersUpperCase, New-RandomPassword
  • 2.1 WriteToConsole switch added to Logger.Write method

Links

Follow

 

 

Read More »