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
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)
Get-Psdrive
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
HKCU Registry HKEY_CURRENT_USER
HKLM Registry HKEY_LOCAL_MACHINE
Variable Variable
WSMan WSMan
Z FileSystem Z:\
Get-website
Name ID State Physical Path Bindings
BI4 2 Started D:\xxx\Sites\xxx\1.0 http :80:
.2881.113 http *:80:xxx.no
DeployWarmupSite 3 Started D:\xxx\Sites\xxx\1.0 http :1111:
.2881.113
#{WarmupSiteName 4 Started D:\xxx\Sites\xxx\1.0 http :81:od-tem
} .2876.108 p.example.com
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.