I am trying to add Remote Implicit functionality to existing Exchange module to allow users to run Exchange cmdlets from their workstations.
Remoting works fine when I use script below:
------------------------------------------
function Enable-ExchangeExplicitRemoting {cmdletbinding()]
param(
[Parameter(ValueFromPipeline=$true)]
[string]$exchServer
)
Write-Verbose "Creating PSSession.."
$global:s = New-PSSession -ConfigurationName Microsoft.Exchange -ConnectionUri http://$exchServer/PowerShell/ -Authentication Kerberos
Write-Verbose -verbose "Importing PSSession"
Import-PSSession $s -Verbose -AllowClobber |out-null
}
Enable-ExchangeExplicitRemoting -exchServer "servername"
VERBOSE: Importing function 'Add-ADPermission'.
VERBOSE: Importing function 'Add-AvailabilityAddressSpace'.
VERBOSE: Importing function 'Add-ContentFilterPhrase'.
.........
get-mailbox
.. mailbox info returned....
---------------------------------------
As a result. 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 , the commandlets are not available:
------------------------
Import-Module Exchange
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