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...
Thatcoder
Feb 20, 2022Copper Contributor
Thanks perhaps it helps.
Feb 27, 2022
What was your final version of the script?
- ThatcoderFeb 28, 2022Copper ContributorI wrote something like this
$servicepath = “zip file location”
$servicename = “installer”
$servicestatus = get-service-name $servicename -erroraction silentlycontinue
If ($servicestatus.status -eq running) {
Stop-process -name $servicename -force }
Expand-Archive -literalpath $servicepath -destinationpath c:/users/ -force
Start-service