Shell.CanStartStopService method

Determines if the current user can start and stop the named service.

Syntax

retVal = Shell.CanStartStopService(
  sServiceName
)

Shell.CanStartStopService( _
  ByVal sServiceName As String _
) As Variant

Parameters

sServiceName [in]

Type: String

A String that contains the name of the service.

Return value

JScript

Type: Variant*

Returns true if the user can start and stop the service; otherwise, false.

VB

Type: Variant*

Returns true if the user can start and stop the service; otherwise, false.

Remarks

This method is not currently available in Microsoft Visual Basic.

Examples

The following examples show the usage of CanStartStopService for JScript and VBScript.

JScript:

<script language="JScript">
    function fnCanStartStopServiceJ()
    {
        var objShell = new ActiveXObject("shell.application");
        var bReturn;

        bReturn = objShell.CanStartStopService("service name");
    }
</script>

VBScript:

<script language="VBScript">
    function fnCanStartStopServiceVB()
        dim objShell
        dim bReturn

        set objShell = CreateObject("shell.application")

        bReturn = objShell.CanStartStopService("service name")

        set objShell = nothing
    end function
</script>

Requirements

Minimum supported client
Windows 2000 Professional, Windows XP [desktop apps only]
Minimum supported server
Windows Server 2003 [desktop apps only]
Header
Shldisp.h
IDL
Shldisp.idl
DLL
Shell32.dll (version 5.0 or later)