Powershell plugin for IIS / Octopus 3.7.16 / Windows Server 2016

We have a step template that creates an app pool and virtual app using the IIS webadministration module for powershell. This has worked great in Win2008_R2. We are now attempting to use same ste template on Win2016 server box but it seems to blow up with a drive not found error when we access the IIS: drive. We can manually run powershell and import the webadminstration module just fine via the console so not sure why it blows up in Octopus. Please advise.

Octopus.txt (7 KB)

Hi Scott,

Thanks for getting in touch! When you say runs fine via the console do you mean locally on the box or the Octopus script console?
When something runs fine locally but not though Octopus the very first thing to check is the permissions for the user the Tentacle service is running under.
If there is a module. method or library the script is running that the user does not have permissions for. I have seen a very similar error when the Windows PowerShell snap-in module was not installed. https://www.iis.net/downloads/microsoft/powershell
It may be an avenue to check.

Let me know what you find.

When I log into the desktop on the target Windows 2016 server, manually run powershell, and type IIS: it just works. The IIS web admin module auto loads and changes the current working directory to the IIS directory. This indicates that the powershell IIS scripting module is installed properly. However, when we run IIS: against the same server using Octopus step template it blows up with a “drive not found” error. We have tried running the tentacle service with a domain admin account and it still blows up with the same error. If this is a permissions issue, please tell me what permission is needed.

Hi Scott,

The script (did you grab it from the library or create it internally?) is not loading the administration module properly. This is how we successfully do it in Calamari that works for all of our supported versions: https://github.com/OctopusDeploy/Calamari/blob/9442cc2d3af862122a1ce164a5eb2e7bd9ec9284/source/Calamari/Scripts/Octopus.Features.IISWebSite_BeforePostDeploy.ps1#L33

If you can’t figure it out, export your step template and attach it.

This is an internal script that we created a few years ago and have used it many times but always against Win2008r2 server. This is our first attempt at using it against Windows server 2016 server. If I knew which permission was necessary, I could possibly put some kind of assertion in the script.
Please see attached step template.

CreateVirtualAppStepTemplate.txt (7 KB)

Hi Scott,

Vanessa has passed this on to me for further investigation.

It seems that the script you sent does not line up with the log file. I can’t see lines like “Step template variable values” being output but I do see “Executing function create-virtualApp”. Could you send a log file that lines up with that version of the script?

Could you also try the following:

  1. Try removing spaces and special characters from the AppPool and website name
  2. Create an empty zip and attempt to deploy it using the built in “Deploy and IIS Web Site” step with the same or similar parameters as your above step.
  3. Try running the Tentacle interactively as a user that can successfully run the scripts. You can do this by stopping the service and then running Tentacle.exe from the command prompt (that has administrative privileges). Then do the deployment again.

Rob W