| 1 |
' 2001-12-09 |
| 2 |
|
| 3 |
Public Function PauseService(ServiceName As String) As Boolean |
| 4 |
|
| 5 |
Dim oSysInfo As New ActiveDs.WinNTSystemInfo |
| 6 |
Dim oComp As ActiveDs.IADsComputer |
| 7 |
Dim oSvcOp As ActiveDs.IADsServiceOperations |
| 8 |
Dim sCompName As String |
| 9 |
Dim sSvc As String |
| 10 |
Dim lRet As Boolean |
| 11 |
|
| 12 |
On Error GoTo errorhandler: |
| 13 |
|
| 14 |
sSvc = ServiceName |
| 15 |
|
| 16 |
sCompName = "WinNT://" & _ |
| 17 |
oSysInfo.ComputerName & ",computer" |
| 18 |
|
| 19 |
Set oComp = GetObject(sCompName) |
| 20 |
Set oSvcOp = oComp.GetObject("Service", sSvc) |
| 21 |
oSvcOp.Pause |
| 22 |
PauseService = True |
| 23 |
Exit Function |
| 24 |
errorhandler: |
| 25 |
PauseService = False |
| 26 |
End Function |