When upgrading SLM the snow services need to be stopped, if there is a monitoring tool or an issue shutting down the services it will cause the upgrade to fail.
The below script has multiple options, you can either just shut down the services or shut down the services and change the Startup Type to Disabled. Once the upgrade is complete you can run the script again to revert the change and set the Snow services to Automatic.
N.B. You may need repeat the process if some of the services have not stopped.
#### Description: # Stop / Start All Snow Services and change startup to Automatic / Disabled uncomment as required# # Version: 1.0# Updated: 20231113# Author: Julian Dalley###
##RUN IN POWERSHELL ISE WITH ADMIN RIGHTS##
#Stopping & starting services###### Uncomment one of the following lines based on the desired actionStop-ServicesBeginningWithSnow#Start-ServicesBeginningWithSnow
#Change the startup type###### Uncomment one of the following lines based on the desired action``Set-ServicesToDisabled#Set-ServicesToAutomatic
# Make sure to use the elevated permissionsif (!([Security.Principal.WindowsPrincipal][Security.Principal.WindowsIdentity]::GetCurrent()).IsInRole([Security.Principal.WindowsBuiltInRole] "Administrator")) { Start-Process powershell.exe "-NoProfile -ExecutionPolicy Bypass -File `"$PSCommandPath`"" -Verb RunAs; exit }
function Set-ServicesToDisabled { # Get all services with names starting with 'Snow' $services = Get-Service | Where-Object { $_.DisplayName -match 'Snow' }
# Set each service to disabled foreach ($service in $services) { Set-Service -Name $service.ServiceName -StartupType Disabled Write-Host "Service $($service.DisplayName) set to Disabled." }}
function Set-ServicesToAutomatic { # Get all services with names starting with 'Snow' $services = Get-Service | Where-Object { $_.DisplayName -match 'Snow' }
# Set each service to automatic foreach ($service in $services) { Set-Service -Name $service.ServiceName -StartupType Automatic Write-Host "Service $($service.DisplayName) set to Automatic." }}
function Stop-ServicesBeginningWithSnow {
# Get all services with names starting with 'Snow' $services = Get-Service | Where-Object { $_.DisplayName -match 'Snow' }
# Stop each service foreach ($service in $services) { Stop-Service -Name $service.ServiceName -Force -WarningAction SilentlyContinue Write-Host "Service $($service.DisplayName) stopped." }}
function Stop-ServicesBeginningWithSnow {
# Get all services with names starting with 'Snow' $services = Get-Service | Where-Object { $_.DisplayName -match 'Snow' }
# Stop each service foreach ($service in $services) { Stop-Service -Name $service.ServiceName -Force Write-Host "Service $($service.DisplayName) stopped." }}
#Function to stop pending servicefunction Stop-ServicesWithStopPending { $Services = Get-WmiObject -Class win32_service -Filter "state = 'stop pending'" if ($Services) { foreach ($service in $Services) { try { Stop-Process -Id $service.processid -Force -PassThru -ErrorAction Stop } catch { Write-Warning -Message "Unexpected Error. Error details: $_.Exception.Message" } } } else { Write-Output "There are currently no services with a status of 'Stopping'." }}
# Call the functionStop-ServicesWithStopPending
function Start-ServicesBeginningWithSnow { # Get all services with names starting with 'Snow' $services = Get-Service | Where-Object { $_.DisplayName -match 'Snow' }
# Start each service foreach ($service in $services) { Start-Service -Name $service.ServiceName Write-Host "Service $($service.DisplayName) started." }}
# Reporting current service status with color-coded output
Write-Host -ForegroundColor Magenta "Reporting current service status"
# Get services with names starting with "Snow"$services = Get-Service -Name "Snow*"
# Display service status and startup type with color-coded outputforeach ($service in $services) { $statusColor = switch ($service.Status) { 'Running' { 'Green' } 'Stopped' { 'Red' } 'Stopping' { 'DarkYellow' } # Using DarkYellow for orange-like color default { 'White' } # You can adjust the default color as needed }
$startupTypeColor = if ($service.StartType -eq 'Automatic') { 'Cyan' } else { 'White' }
Write-Host -ForegroundColor $statusColor -NoNewline "$($service.DisplayName) is $($service.Status) with startup type " Write-Host -ForegroundColor $startupTypeColor "$($service.StartType)"
}
Write-Host -ForegroundColor Yellow "If all services are not stopped / started run again"
Related Articles
PowerShell script to identify folders exceeding specified size 6Number of Views PowerShell script to monitor the log files generated and deleted in a folder 12Number of Views Export Windows Event logs for powershell using a PowerShell script 7Number of Views PowerShell script to monitor the process and folders used by the cloud metering process 76Number of Views PowerShell script to return the name of the application process that is using a port 5Number of Views
Hi, I am Reva - Ask me anything.
No new updates
Thanks for the feedback!
Your feedback has been saved.Rate this response:
Add Additional feedback ( Optional )
Are you sure you want to cancel
the case creation?
Are you sure you want to cancel the case creation?
Are you sure you want to close this case
| Products | Region | Phone Numbers |
|---|---|---|
| FlexNet Operations FlexNet Embedded FlexNet Publisher FlexNet Connect FlexNet Code Insight InstallAnywhere InstallShield |
North America * |
+1 630-332-2513 (toll) +1 877-279-2853 (toll-free in North America) |
| Europe * |
+44 1925 944367 (toll) +44 800 047 8642 (toll-free in Europe) |
|
| Japan * | +81 3-4540-5335 (select option 2) | |
| Australia * |
+61 3 9895 2177 +61 1800 560 603 (toll-free in Australia) |
|
|
Usage Intelligence (formerly
Revulytics) Compliance Intelligence |
Please use the Case Portal to submit your support ticket or reach out to your Revenera contact. | |
Revenera Assistant
Case id: 00001065
Activity: Status change: 2 hours ago