Jump to content
Der letzte Beitrag zu diesem Thema ist mehr als 180 Tage alt. Bitte erstelle einen neuen Beitrag zu Deiner Anfrage!

Recommended Posts

Posted

das geht auch ohne resource kit - kannst den download beim esel wieder stoppen ;)

aus dem script repository des w2k3 servers

Install a Service

 

Description

Installs a hypothetical service Db.exe.

 

Script Code

 

Const OWN_PROCESS = 16

Const NOT_INTERACTIVE = False

Const NORMAL_ERROR_CONTROL = 2

 

strComputer = "."

Set objWMIService = GetObject("winmgmts:" & _

"{impersonationLevel=Impersonate}!\\" & strComputer & "\root\cimv2")

 

Set objService = objWMIService.Get("Win32_BaseService")

errReturn = objService.Create("DbService", _

"Personnel Database", _

"c:\windows\system32\db.exe", _

OWN_PROCESS, _

NORMAL_ERROR_CONTROL, _

"Manual", _

NOT_INTERACTIVE, _

"NT AUTHORITY\LocalService", "")

 

Wscript.Echo errReturn

 

 

The System Administration Scripting Guide, part of the Windows .NET Server Resource Kit. For more information, contact scripter@microsoft.com.

Posted

der vollständigkeit halber mal noch das gegenstück ;)

strComputer = "."

Set objWMIService = GetObject("winmgmts:" _

& "{impersonationLevel=impersonate}!\\" & strComputer & "\root\cimv2")

Set colListOfServices = objWMIService.ExecQuery _

("Select * from Win32_Service Where Name = 'MySql'")

For Each objService in colListOfServices

objService.StopService()

objService.Delete()

Next

MySql ist hier analog durch den Servicenamen oder den Anzeigenamen zu ersetzen.
Der letzte Beitrag zu diesem Thema ist mehr als 180 Tage alt. Bitte erstelle einen neuen Beitrag zu Deiner Anfrage!

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...