meenakshiBalekar - Thank you for the quick response.
I have attempted various methods to bind the certificate to the website, however I get different results. Quite frustrating if you ask me.
I have taken your script and on one server the IIS drive works. On another server, there is no IIS drive and it fails. I was under the impression the IIS drive was being replaced by IIS specific cmdlets. Additionally, I cannot assume how users will have their servers configured to use/have the IIS drive available. If the IIS drive will continue to be supported, what makes that drive available? I have imported the Administrator Module; is there something that needs to be selected when installing IIS on the server?
In another strange twist, the server that does not have the IIS drive available, I am using VS Code to write and test my scripts (one of my many environments). Since the IIS drive is unavailable, I am attempting to use the AddSslCertificate method, but continue to get the following error:
Method invocation failed because [Deserialized.Microsoft.IIs.PowerShell.Framework.ConfigurationEle
ment#bindings#binding] does not contain a method named 'AddSslCertificate'
I find it strange, as I am not doing any remoting, just straight function calls. I'm wondering if PS 7.4.2 vs 5.1 is an issue. Only reason why I mention that is, I have another test app that connects to the remote machine via Ssh, delivers the PS1 file and then executes the function using the PowerShell -Command method.
My apologies as my testing environments are a mess right now due to various scenarios, but I will continue to get this working for all situations. I appreciate your time and effort. I hope to resolve this shortly.