Search code examples
powershelliiswwwroot

IIS Stop Necessary before Zipping/Copying wwwroot


I am making a compressed copy of our wwwroot file via powershell and the Compress-Archive command. Is there a compelling reason to stop iis (or the website/apppool) before making a copy. I will be using this copy to update our test environment.

The documentation around the Compress-Archive doesn't make it clear what will happen if a file is locked. https://learn.microsoft.com/en-us/powershell/module/microsoft.powershell.archive/compress-archive?view=powershell-7.2


Solution

  • If you are not completely sure, you'd better stop this website and recycle the application pool, any uncertainty may cause your compression to be incomplete, because there may be some files in your project folder that are still in process , which will cause these files to fail to compress.