Search the Community
Showing results for tags 'serice'.
-
PowerShell script to update server when running as a service
Quicky posted a topic in General/Windows
Hi all, I've been using emby as a service for while now, and having gone through quite a few updates of the server, have always found it a bit long-winded to complete the update steps, thanks to the emby installer automatically starting the desktop app version of the server rather than the service. I've finally got round to writing a quick PowerShell script that automates it a bit more: stop the current service, download the server installer, run the installer, kill the emby app and finally start the service again. I've posted it here in case anyone's got a similar workflow to me for updating emby, and is only marginally lazier than I am: # Installer download path $downloadPath = "$env:USERPROFILE\Downloads" # Stop the emby service $service = 'Media Browser' if ((get-service -DisplayName $service).Status -eq "started") { Stop-Service -DisplayName $service } # Download installer $filename = 'setup.exe' $source = "http://mb3admin.com/downloads/release/server/$filename" $destination = $downloadPath + $fileName Invoke-WebRequest $source -OutFile $destination # Run installer & $destination | Out-Null # Kill the emby app that gets started. $emby = Get-Process -Name MediaBrowser.ServerApplication -ErrorAction SilentlyContinue while (!$emby) { # Check the app is running. Wait until it starts Sleep 5 $emby = Get-Process -Name MediaBrowser.ServerApplication -ErrorAction SilentlyContinue } Stop-Process $emby -Force Sleep 5 # Delete downloaded installer Remove-Item $destination #Restart the emby service Start-Service -DisplayName $service- 18 replies
-
- 6
-
- server
- powershell
-
(and 2 more)
 Tagged with: