Get-Item : Cannot find path 'IIS:\Sites\DeployWarmupSite' because it does not exist

I have this script that starts a site in IIS.

Import-Module WebAdministration
$site = Get-Item “IIS:\Sites\DeployWarmupSite”

When I run the script locally on the server it works. It also works when running it in the context of Tentacle.exe on the server. However when the script runs from octopus I get this error:

Get-Item : Cannot find path ‘IIS:\Sites\DeployWarmupSite’ because it does not exist.
At C:\Windows\system32\config\systemprofile\AppData\Local\Tentacle\Temp\cb53b94
f-9ab3-4a9c-be15-bfd2f523049a.ps1:7 char:17

  • $site = Get-Item <<<< “IIS:\Sites\DeployWarmupSite”
  • CategoryInfo : ObjectNotFound: (IIS:\Sites\DeployWarmupSite:String) [Get-Item], ItemNotFoundException
  • FullyQualifiedErrorId : PathNotFound,Microsoft.PowerShell.Commands.GetItemCommand

Hi Sigve,

Thanks for getting in touch! We have a library step specifically for starting IIS sites in case you want to try it out!/step-template/actiontemplate-iis-website-start

If you want to stick with using the script, the first thing i would check is if the account running the tentacle service has admin right on that VM. Could you try remoting into the tentacle with this account and running the script?



The script I’m runing is identical to the library just without the output stuff.

The user the service is running under has admin rights and as I mentioned in my original post I have tried running the script locally on the server with success. Both in the poweshell command window and in the regular command window running it in context of Tentacle.exe

The weird thing is that the deploy step is successful even though it runs the “Octopus.Features.IISWebSite_BeforePostDeploy.ps1” script which contains the exact same way of getting a site in IIS.


Could you try running your exact command on the same tentacle using the Script Console in Octopus? This is usually the best way to troubleshoot problems with custom scripts, as it runs them almost identically as they would run during a deployment process.

If that doesnt work, try running these commands on the Script console like:

Get-module -listavailable (to make sure the IIS module is being loaded)

Get-Psdrive (to make sure the IIS drive is mounted)

Get-website (to make sure that the website can be found)

Let me know how those tests go


This was my results:

Get-module -listavailable
ModuleType Version Name ExportedCommands

Manifest ADRMS {Update-ADRMS, Uni…
Manifest AppLocker {Set-AppLockerPoli…
Manifest 1.0 BestPractices {Get-BpaModel, Inv…
Manifest BitsTransfer {Add-BitsFile, Rem…
Manifest CimCmdlets {Get-CimAssociated…
Manifest Microsoft.PowerShell.Diagnostics {Get-WinEvent, Get…
Manifest Microsoft.PowerShell.Host {Start-Transcript,…
Manifest Microsoft.PowerShell.Management {Add-Content, Clea…
Manifest Microsoft.PowerShell.Security {Get-Acl, Set-Acl,…
Manifest Microsoft.PowerShell.Utility {Format-List, Form…
Manifest Microsoft.WSMan.Management {Disable-WSManCred…
Binary 1.0 PSDesiredStateConfiguration {Set-DscLocalConfi…
Script PSDiagnostics {Disable-PSTrace, …
Binary PSScheduledJob {New-JobTrigger, A…
Manifest PSWorkflow {New-PSWorkflowExe…
Manifest PSWorkflowUtility Invoke-AsWorkflow
Manifest ServerManager {Get-WindowsFeatur…
Manifest TroubleshootingPack {Get-Troubleshooti…
Manifest WebAdministration {Start-WebCommitDe…
Directory: C:\Program Files (x86)\Microsoft SQL Server\120\Tools\PowerShell
ModuleType Version Name ExportedCommands

Manifest 1.0 SQLASCMDLETS {Add-RoleMember, B…
Manifest 1.0 SQLPS {Backup-SqlDatabas…

Info 21:29:17
Name Used (GB) Free (GB) Provider Root

A FileSystem A:\
Alias Alias
C 36,28 13,62 FileSystem C:\
Cert Certificate \
D 18,80 21,20 FileSystem D:\
Env Environment
Function Function
Variable Variable
Z FileSystem Z:\

Name ID State Physical Path Bindings

BI4 2 Started D:\xxx\Sites\xxx\1.0 http :80:
.2881.113 http *
DeployWarmupSite 3 Started D:\xxx\Sites\xxx\1.0 http :1111:
#{WarmupSiteName 4 Started D:\xxx\Sites\xxx\1.0 http :81:od-tem
} .2876.108

I figured it out.

I ran the following in the Script Console and now it works.

Import-Module ServerManager
Add-WindowsFeature Web-Scripting-Tools

Thanks, Sigve!

Thanks for this post. It helped me too!


This issue has been closed due to inactivity. If you encounter the same or a similar issue and require help, please open a new discussion (if we asked for logs or extra details in this thread, consider including them in the new thread). If you are the creator of this thread and believe it should not be closed let us know via our support email.