Powershell post-request FTP script

Can FTP be added as an option for deployment ?

OR

Can CTW post a known good working post-request for FTP that:

  1. Only runs if new cert was issued
  2. Logs output somewhere in the case of errors
  3. When you test it outputs success/fail or error info…

There is “1” post on the web I found with some info and I adapted slightly based on the admin comments to the thread. The below works, but it would be nice to include something like this as you do for Exchange/RDP etc:

param($result)
Import-Module -Name webadministration
$FTPsite = ‘IIS:\Sites\AB_FTP’
Set-ItemProperty -Path $FTPsite -Name ftpServer.security.ssl.serverCertHash -Value $result.ManagedItem.CertificateThumbprintHash

Hi,

When I read this I first thought you wanted to FTP the certificate file but you no, you want to assign the certificate on the FTP binding in IIS.

If the renewal failed the $result.IsSuccess will be False so you can wrap the whole thing in an If but I don’t see any disadvantage to setting the thumbprint anyway as it will still be the last valid value.

Our method for Test is basic and runs in the UI process under the current user so it’s not really a true test. Yes, more needs to be done there.