Using VBScript how can I check if the Spooler service is started and if not start it? -
i'd use vbscript check if spooler service started , if not start it, code below checks service status need modifying can check if started.
strcomputer = "." set objwmiservice = getobject("winmgmts:" _ & "{impersonationlevel=impersonate}!\\" & strcomputer & "\root\cimv2") set colrunningservices = objwmiservice.execquery _ ("select * win32_service") each objservice in colrunningservices wscript.echo objservice.displayname & vbtab & objservice.state next
many steven
how this. command start if isn't running. no need check in advance.
dim shell set shell = createobject("wscript.shell") shell.run "net start spooler", 1, false
Comments
Post a Comment