Powershell Explicit Remoting for Exchange Does Not Work from Module

I am trying to create module for users so they can run Exchange cmdlets from their desktops.

This works fine when I use script below

function Enable-ExchangeExplicitRemoting {cmdletbinding()]
param(
[Parameter(ValueFromPipeline=$true)]
[string]$exchServer
)    
Write-Verbose "Creating PSSession.."
$s = New-PSSession -ConfigurationName Microsoft.Exchange -ConnectionUri  -Authentication Kerberos 

Write-Verbose -verbose "Importing PSSession" 
Import-PSSession $s -Verbose -AllowClobber |out-null
}
Enable-ExchangeExplicitRemoting -exchServer "servername"

I am able to run Exchange cmdlets on remote server and get the data back.

However if I add this function to an existing module , and then load this module , this function does not load from the module as expected.

>get-command Enable-ExchangeImplicitRemoting
CommandType     Name
-----------     ----
Function        Enable-ExchangeImplicitRemoting

Enable-VTBExchangeImplicitRemoting -exchServer "servername"

VERBOSE: Importing function 'Add-ADPermission'.
VERBOSE: Importing function 'Add-AvailabilityAddressSpace'.
VERBOSE: Importing function 'Add-ContentFilterPhrase'.
.......    
get-mailbox
The term 'get-mailbox' is not recognized as the name of a cmdlet, function, scrip
2
Robert Thorne

Robert Thorne

Automotive & Future Transportation Editor

Robert Thorne covers electric vehicle innovations, autonomous driving systems, global mobility trends, and automotive engineering developments.

Share this article