Currently I am using this Powershell script which runs before deployment.
$Password=Convertto-SecureString -String ${bamboo.deploy.password} -AsPlainText -force
$Credentials=New-object System.Management.Automation.PSCredential ${bamboo.deploy.username},$Password
Enter-PSSession -ComputerName ${Server} -Credential $Credentials
Invoke-Command -ScriptBlock {start cmd;cd C:\Windows\System32\inetsrv;appcmd stop apppool /apppool.name:"${app_pool_name}"}
But it gives the following error:
The term 'appcmd' is not recognized as the name of a cmdlet, function, script file, or operable program. Check the spelling of the name, or if a path was included, verify that the path is correct and try again.
I have also tried using the Stop-WebAppPool cmdlet. It also gave an error saying Stop-WebAppPool is not recognized as the name of any cmdlet. I have also tried Import-Module WebAdministration before Stop-WebAppPool cmdlet. It also was not successful.
Hi @l.aizdi,
Sorry no one has been able to help you with this issue yet.
Looking at it, my first thought would be to check what Powershell modules are installed/imported on your web server.
Stop-WebAppPool is not a part of the standard Powershell library. It's part of the WebAdministration Module which would need to be imported ahead of running the command.
What you can do, is add an if block to check if the WebAdministration module exists, and if not run:
Import-Module WebAdministration
I understand you may have solved this already but if not, I hope that might help you out.
-Jimmy
Online forums and learning are now in one easy-to-use experience.
By continuing, you accept the updated Community Terms of Use and acknowledge the Privacy Policy. Your public name, photo, and achievements may be publicly visible and available in search engines.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.