Example script for Exchange doesn't work
Hi!
Looking at https://github.com/webprofusion/certify/blob/development/docs/Request%20Script%20Hooks.md,
The script for loading the exchange certificate
param($result)
Enable-ExchangeCertificate -Thumbprint $result.ManagedItem.CertificateThumbprintHash -Services POP,IMAP,SMTP,IIS
doesn't work, giving the following error
Post-Request Script output: Enable-ExchangeCertificate: The term 'Enable-ExchangeCertificate' is not recognized as the name of a cmdlet, function, script file, or operable program. Check the spelling of the name, or if a path was included, verify that the path is correct and try again
I guess this is because the base powershell doesn't include the connection to Exchange.
I've tried adding in
$CallEMS = ". '$env:ExchangeInstallPath\bin\RemoteExchange.ps1'; Connect-ExchangeServer -auto -ClientApplication:ManagementShell "
Invoke-Expression $CallEMS
This works using an administrative powershell session, but does not work when testing with CertifyTheWeb, giving a bunch of errors saying cannot find the file specified
Any ideas on how to get around this?
Hi, can you confirm which version if Exchange this is and that you're running Certify on the same server exchange is installed on?
Hi, this is with Exchange 2013, and yes, it's on the same machine.
Thanks, and is this Windows Server 2012?
yep - Server 2012 R2
Under the latest version of Certify, the background service does all the work as Local System, so you may need to make sure Local System has admin rights for Exchange
@mobiusnz
i had the same problem, but i have a working script now!
Note > Change "Server01" to you Exchange Server Name ;)
param($result) set-alias ps64 "$env:windir\sysnative\WindowsPowerShell\v1.0\powershell.exe" ps64 -args $result -command { $result = $args[0] write-output "Powershell Script Erfolgreich?" $result.IsSuccess Add-PSSnapin Exchange Enable-ExchangeCertificate -Server "Server01" -Thumbprint $result.ManagedItem.CertificateThumbprintHash -Services "SMTP, IMAP, POP, IIS" –Force }
Great! We should probably just look at getting the powershell engine to be 64bit by default, unless you're on 32-bit. We currently run 32-bit because there's some users on 32-bit server 2008/2008 r2.
Is 'Add-PSSnapin Exchange' required?
i see the form here don't like the * yes you need this command to include the Exchange PSSnapin
the command is: Add-PSSnapin * Exchange * > delete the blank space before/after the *
Closing as resolved