Corey Lambert wrote:
Use this switch when testing your remote PowerShell: -UseSSL
example: Enter-PSSession -ComputerName <dc_name> –credential <credentials> -UseSSL
If it fails that is your problem and my above comment will fix it.
I also looked for the script they use to scan Exchange and was unsuccessful in finding it. I was going to try and modify it not to use SSL.
3cardmagictrick wrote:
Jim Gallott wrote:
I have tested remote powershell successfully from the scanning server to the exchange servers using:
https://docs.microsoft.com/en-us/powershell/exchange/connect-to-exchange-servers-using-remote-powershell?view=exchange-ps
All three connect and I can run Get-mailbox.
I did remote powershell successfully to the preferred domain controller using:
Enter-PSSession -ComputerName <dc_name> –credential <credentials>
Still Exchange won't scan. It does not seem to be the remote powershell that is getting in the way.
Same here, can connect fine remotely via PowerShell. Does anyone know where the script LANSweeper runs to scan Exchange is located? Or what commands it runs?
Reason I ask is I was hoping to connect manually and run these myself to troubleshoot further.
Use this switch when testing your remote PowerShell: -UseSSL
example: Enter-PSSession -ComputerName <dc_name> –credential <credentials> -UseSSL
Originally connecting remotely using Enter-PSSession was failing but the comment and article you shared with steps on how to configure an SSL self signed certificate worked perfectly, seriously cannot thank you enough for that. I'm 100% self taught with PowerShell and I am a total amateur at best so was so satisfying to read that article you shared
😉I can connect perfectly fine now however I'm getting this error
😞PS C:\Users\USERNAME> Enter-PSSession -ComputerName EXCHANGE SERVER NAME -credential DOMAIN\USERNAME -UseSSL
PowerShell credential request
Enter your credentials.
Password for user DOMAIN\USERNAME: **********
[EXCHANGE SERVER NAME]: PS C:\Users\USERNAME\Documents> Add-PSSnapin Microsoft.Exchange.Management.PowerShell.SnapIn
[EXCHANGE SERVER NAME]: PS C:\Users\USERNAME\Documents> Get-Mailbox
Active Directory operation failed on . The supplied credential for 'DOMAIN\USERNAME' is invalid.
+ CategoryInfo : NotSpecified: (:) [], ADInvalidCredentialException
+ FullyQualifiedErrorId : [Server=EXCHANGE SERVER NAME,RequestId=aa150a06-0e4d-4cf3-97f8-dc627c72beb9,TimeStamp=19/10/2021 9:47:15 PM] [FailureCategory=Cmdlet-ADInvalidCredentialException] 476A3E7D
Interesting thing is I found this article (
https://www.alitajran.com/load-exchange-management-shell-in-powershell-ise/#:~:text=To%20load%20Exch...) and when I follow the steps in listed under the "Connect to Exchange servers with remote PowerShell" section it works PERFECTLY!
$UserCredential = Get-Credential
$Session = New-PSSession -ConfigurationName Microsoft.Exchange -ConnectionUri http://EXCHANGE SERVER NAME/PowerShell/ -Authentication Kerberos -Credential $UserCredential
Import-PSSession $Session -DisableNameChecking
Get-Mailbox