We have a application service that fails to start each time the server is patched.
I would like to make a task to start the service, but the service name changes each time the application updates.
The service name now is “MFServer 23.6.12695.4”
Is there a way BigFix can first figure out the full service name, and start that service?
I’m hoping that each update will only affect version information, leaving the initial characters untouched.
//Applicability Relevance
Windows of operating system AND exists service whose (service name of it as lowercase starts with "MFServer" as lowercase)
//Action Script
delete __createfile
delete "__Download\Start_Service.bat
createfile until EOF
{concatenation "%0a" of ("sc start %22" & it & "%22") of (service names of services whose (service name of it as lowercase starts with "MFServer" as lowercase))}
EOF
move __createfile "__Download\Start_Service.bat"
//override timeout after 2 min
override wait
hidden=true
timeout_seconds=120
disposition=terminate
wait cmd.exe /c "__Download\Start_Service.bat"
continue if {exists services whose (service name of it as string as lowercase starts with "mfserver")}
parameter "_Servicename"="{(service name of it) of services whose (service name of it as string as lowercase starts with "mfserver")}"
dos net start "{parameter "_Servicename"}"
If you want, you could also have it check if the service is running.
continue if {exists services whose (service name of it as string as lowercase starts with "mfserver")}
continue if {(state of it) of service whose (service name of it as string as lowercase starts with "mfserver") as lowercase = "stopped"}
parameter "_Servicename"="{(service name of it) of services whose (service name of it as string as lowercase starts with "mfserver")}"
dos net start "{parameter "_Servicename"}"