<p class=“_1qeIAgB0cPwnLhDF9XSiJM”>Hi,</p>
<p class=“_1qeIAgB0cPwnLhDF9XSiJM”>I am trying to create this powershell module to enable me to connect to our exchange 2010 server via powershell.</p>
<p class=“_1qeIAgB0cPwnLhDF9XSiJM”>Below is what is in the module script file (.psm1):</p>
Function Connect-ExchangeOnPrem { $Session = New-PSSession -ConfigurationName Microsoft.Exchange -ConnectionUri http://server.company.co.uk/PowerShell -Authentication Kerberos -Credential dgoodwin Import-PSSession $Session -DisableNameChecking -AllowClobber }
When I import this module into PowerShell then run Connect-ExchangeOnPrem, I get the error shown in the link which contains a screenshot:
https://ibb.co/FmsL67B
<p class=“_1qeIAgB0cPwnLhDF9XSiJM”>However, if I was to run the commands in the module script manually, it connects to the exchange server without any issues.</p>
<p class=“_1qeIAgB0cPwnLhDF9XSiJM”>Can anyone see anything wrong with my script or what could be the issue here?</p>
<p class=“_1qeIAgB0cPwnLhDF9XSiJM”>Thanks,</p>
<p class=“_1qeIAgB0cPwnLhDF9XSiJM”>Dan</p>