Salar
Salar

Reputation: 13

How to stop a IIS Website completely from powershell?

I'm trying to write a backup plan with powershell that archives the website root directory and send it to sftp server. The problem is that even when I stop the website with either of these two commands

Stop-WebSite "website"
Stop-IISSite -Name "website"

as the compression wants to start it throws an error as following

ZipArchiveHelper : The process cannot access the file 'C:\inetpub...\www\AutoMapper.dll' because it is being used by another process. At C:\Windows\system32\WindowsPowerShell\v1.0\Modules\Microsoft.PowerShell.Archive\Microsoft.PowerShell.Archive.psm1:697 char:30

When I stop the website from IIS manager the code works fine, so is there any way to stop a website completely from Powershell?

Upvotes: 1

Views: 926

Answers (1)

sujayadkar
sujayadkar

Reputation: 113

You can try to stop the App Pool of the Website. So it will not load process.

Step will be, 1.Stop IIS Website. 2.Stop IIS Website App Pool. 3.Copy Files

Upvotes: 1

Related Questions