See: NSSM - the Non-Sucking Service Manager
nssm.exe install SERVICE_NAME "C:\path\to\exe\or\bat\file.ext" "argument1 argument2"
nssm.exe get SERVICE_NAME *
nssm.exe set SERVICE_NAME PARAMETER_NAME PARAMETER_VALUE
nssm.exe set SERVICE_NAME Description "My service description."
nssm.exe set SERVICE_NAME Start SERVICE_AUTO_START
nssm.exe set SERVICE_NAME AppExit Default Exit
nssm.exe set SERVICE_NAME AppStdout "C:\log\service-output.log"
AppAffinity
AppDirectory
AppEnvironment
AppEnvironmentExtra
AppExit
Application
AppNoConsole
AppParameters
AppPriority
AppRestartDelay
AppRotateBytes
AppRotateBytesHigh
AppRotateFiles
AppRotateOnline
AppRotateSeconds
AppStderr
AppStderrCreationDisposition
AppStderrFlagsAndAttributes
AppStderrShareMode
AppStdin
AppStdinCreationDisposition
AppStdinFlagsAndAttributes
AppStdinShareMode
AppStdout
AppStdoutCreationDisposition
AppStdoutFlagsAndAttributes
AppStdoutShareMode
AppStopMethodConsole
AppStopMethodSkip
AppStopMethodThreads
AppStopMethodWindow
AppThrottle
DependOnGroup
DependOnService
Description
DisplayName
ImagePath
Name
ObjectName
Start
Type
I need to be able to stop and start the service under a standard user account. I have tried to use the runas command (See Below) but I have not had any luck to get it to work.
C:\windows\system32>runas /user:server\support /savecred "c:\kds\nssm stop KDS_MANAGER"
Attempting to start c:\kds\nssm stop KDS_MANAGER as user "server\support" ...
I see a window open and close very fast but the service does not stop
If I use "nssm stop KDS_MANAGER" on the same command prompt the service stops but this only works if the CMD prompt is run as administrator or I need to provide credentials. I am trying to get this to run without having to enter admin credentials.
I have also tried using batch files with no luck.
Any help to solve this would be greatly appreciated.
Regards,
Joe