Come for the products,
stay for the community

The Atlassian Community can help you and your team get more value out of Atlassian products and practices.

Atlassian Community about banner
Community Members
Community Events
Community Groups

How to start/stop Website and application pool on another server while deploying my project?


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 /"${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.

1 answer

0 votes
Jimmy Seddon Community Leader Jul 02, 2021

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.


Suggest an answer

Log in or Sign up to answer

Atlassian Community Events