I silently install MongoDB, and configure the database successfully via my vbs script. I can tell from going into Windows services that the MongoDB service is installed properly. I just need to start it. In my script, I attempt to start the service with the following:
Code: Select all
strComputer = "."
Set objWMIService = GetObject("winmgmts:{impersonationLevel=impersonate}!\\" & strComputer & "\root\cimv2")
Set colListOfServices = objWMIService.ExecQuery("Select * from Win32_Service Where Name = 'MongoDB'")
For Each objService in colListOfServices
objService.StartService()
Next
Any idea why this won't work? Is there a better practice to this?
Thanks!