when we tried to deploy our web site to IIS 7 the deployment task failed with the error:
`Import-Module : The specified module ‘WebAdministration’ was not loaded because
Error 14:43:35
no valid module file was found in any module directory.
Error 14:43:35
At C:\Program Files\Octopus Deploy\Tentacle\Scripts\Octopus.Features.IISWebSite
Error 14:43:35
_BeforePostDeploy.ps1:49 char:14
Error 14:43:35
I was able to get this working just yesterday in 2.3.x by modifying the Octopus IIS7 deployment script, but there ended up being other things that failed down the line. I’m unsure if they were related to the environment or differences in the powershell functionality between Windows versions. I can pasted the snippet below over the top of the ‘Import-Module WebAdministration’ line in the powershell file.
Im using version 2.4.10.235 and get something like the message below. The builds get to the server fine. The issue is deploying to IIS. Seems the powershell script cant find the website folders. I have a pretty standard install of IIS. Do I have to modify that file to get it to work?
This is the error :
Push-Location : Cannot find drive. A drive with the name ‘IIS’ does not exist.
Error 03:57:43
At C:\Accounts\Octopus Deploy\Tentacle\Scripts\Octopus.Features.IISWebSite_Befo
Error 03:57:43
rePostDeploy.ps1:136 char:6
Error 03:57:43
I am glad you were able to resolve your issue. As for your packages, they deploy with the same file structure for which they were created - hopefully this will help you find the issue.
I am getting the same error
Push-Location : Cannot find drive. A drive with the name ‘IIS’ does not exist.
version: 2.6.0.778
Installed Octopus in Windows server enterprise (sp2) 64bit machine
I have tried to install the snappin using these commands
Push-Location : Cannot find drive. A drive with the name ‘IIS’ does not exist.
At C:\Program Files\Octopus Deploy\Tentacle\Scripts\Octopus.Features.IISWebSite
_BeforePostDeploy.ps1:217 char:6
pushd <<<< IIS:\
CategoryInfo : ObjectNotFound: (IIS:String) [Push-Location], Dr
iveNotFoundException
FullyQualifiedErrorId : DriveNotFound,Microsoft.PowerShell.Commands.Push
LocationCommand
PowerShell script returned a non-zero exit code: 1
Tentacle version 2.6.0.778
You can manually install the Snap-in on IIS 7.0 from the following link, but i would recommend to investigate first if this is applicable to your Windows version
Deploying package ‘D:\Octopus\Files\Demo.XBanking.1.1.0.0.nupkg-8420f262-7eac-4f79-8389-6e94b49060f5’ to machine 'https://xxx:10933/'
17:12:41Info
Deploying package: D:\Octopus\Files\Demo.XBanking.1.1.0.0.nupkg-8420f262-7eac-4f79-8389-6e94b49060f5
17:12:42Info
Transforming ‘D:\Octopus\Applications\Test - Local\Demo.XBanking\1.1.0.0_1\Web.config’ using ‘D:\Octopus\Applications\Test - Local\Demo.XBanking\1.1.0.0_1\Web.Release.config’.
17:12:43Error
Push-Location : Cannot find drive. A drive with the name ‘IIS’ does not exist.
17:12:43Error
At D:\Octopus\Applications\Test - Local\Demo.XBanking\1.1.0.0_1\Octopus.Feature
17:12:43Error
s.IISWebSite_BeforePostDeploy.ps1:214 char:6
17:12:43Error
pushd <<<< IIS:
17:12:43Error
CategoryInfo : ObjectNotFound: (IIS:String) [Push-Location], Dr
17:12:43Error
iveNotFoundException
17:12:43Error
FullyQualifiedErrorId : DriveNotFound,Microsoft.PowerShell.Commands.Push
17:12:43Error
LocationCommand
17:12:43Error
17:12:43Error
Script ‘D:\Octopus\Applications\Test - Local\Demo.XBanking\1.1.0.0_1\Octopus.Features.IISWebSite_BeforePostDeploy.ps1’ returned non-zero exit code: 1
17:12:43Error
Running rollback conventions…
17:12:43Error
Script ‘D:\Octopus\Applications\Test - Local\Demo.XBanking\1.1.0.0_1\Octopus.Features.IISWebSite_BeforePostDeploy.ps1’ returned non-zero exit code: 1
17:12:43Error
The remote script failed with exit code 1
I’m getting a similar error when I’m trying to install an offline package drop, on Windows 2012 R2 Standard, x64, with Octopus 3.2.13.
The target web application is an IIS website.
I’m running this deployment for testing purposes, on my account that is also member of local Administrators.
When I’m running the same deployment against a Tentacle, that runs as LocalSystem, everything works well.
pushd : Cannot find drive. A drive with the name ‘IIS’ does not exist.
At C:\inetpub\wwwroot\MyWebSite\Octopus.Features.IISWebSite_BeforePostDeploy.ps1:264 char:1
The message Cannot find drive. A drive with the name 'IIS' does not exist. Is usually related to problems loading the WebAdministration module. In this case it could mean any of these things:
The machine where you are running this offline package has IIS installed, but it doesnt have the webadministration module on it. Though if you say the deployment runs fine when running it from a Tentacle, I’d say the module is on the machine already.
You user doesn’t have enough permissions to import this module. Running import-module webadministration from a Powershell (admin) console could clear this up for you.