Visual Basic Script to force a Windows 7 service to start

I have an application that is designed for a tablet, but my PC is a desktop machine.  The application supports pen writing, but I only need it for a "stamp" function.  I always get an error message that "Tablet PC Input Service" is not running.  I have set it to Auto, but when I reboot it goes back to manual.  So I would like a VBScript to force the service on, and I'll set the script to always run at startup.  I am rather experienced with VBS, but no idea as to how to force a service to ON.  I am using Windows 7-64 SP1.
LVL 1
Mike CaldwellConsultant to IP industryAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

NVITCommented:
Here's a vbs to start a service. No error checking done.
Replace ServiceNameHere with your desired service name:
'Start Service
 strServiceName = "ServiceNameHere"
 Set objWMIService = GetObject("winmgmts:{impersonationLevel=impersonate}!\\.\root\cimv2")
 Set colListOfServices = objWMIService.ExecQuery ("Select * from Win32_Service Where Name ='" & strServiceName & "'")
 For Each objService in colListOfServices
    objService.StartService()
 Next

Open in new window


Code is from this page: http://www.itninja.com/question/how-do-i-stop-start-service-in-vbscript
Further down on same page is code with error checking. Search for the text "Should that not be"
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
Mike CaldwellConsultant to IP industryAuthor Commented:
Code works perfectly!  Note to anyone finding this later in a search:

In Windows 7 the service is titled "Tablet PC Input Service", but that is really a stand-in for what the service is really called:  "TabletInputService".  The first one does not work, gotta use "TabletInputService".  I want this to run automatically at startup, but my version of Windows 7 does not have {gpedit.msc} supported, and all of the startup folders deny me access, so I'll accept this solution for starting the service and make a new request for how to launch at startup.

Thanks again.
0
NVITCommented:
You're welcome, Mike. Have a good one.
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
VB Script

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.