TUTOS.EU

Arreter tous les services

Arreter tous les services qui ont un nom qui ressemble a

strComputer = "."
Set objWMIService = GetObject("winmgmts:{impersonationLevel=impersonate}!\\" & strComputer & "\root\cimv2")

Set colListOfServices = objWMIService.ExecQuery _
        ("Select * from Win32_Service WHERE Name LIKE 'myservicenamelike%'")

Set Shell = WScript.CreateObject("WScript.Shell")

For Each objService in colListOfServices
    'wscript.echo objService.Name
    'wscript.echo objService.State

	'If the service is actually running
    If objService.State = "Running" Then
        commandLine = "Net Stop """ & objService.Name & """"
        'wscript.echo commandLine
        Set oExec = Shell.Exec(commandLine)
    End If
Next

Set Shell = Nothing
Lien vers le fichier : cliquez ici Copier le code

2