Forum Discussion
Thatcoder
Feb 20, 2022Copper Contributor
Script to update files
I'm writing a chocolatey installation script which installs a service from a zip file. (ziplocation = C:\Reference\file.zip) At the end of script, I want to stop the service, replace/update the file...
Feb 20, 2022
Don't know what service it is and how it behaves, but a stop-service -force:$true is perhaps an option and a check before starting the service if it's actually stopped and kill it if not? Something like: if ((get-service -name nameofservice).status -ne 'Stopped') {get-process nameofprocess | stop-process -force}