This documentation is archived and is not being maintained.

ServiceController Constructor (String, String)

.NET Framework 1.1

Initializes a new instance of the ServiceController class that is associated with an existing service on the specified computer.

[Visual Basic]
Public Sub New( _
   ByVal name As String, _
   ByVal machineName As String _
)
[C#]
public ServiceController(
   string name,
 string machineName
);
[C++]
public: ServiceController(
   String* name,
 String* machineName
);
[JScript]
public function ServiceController(
   name : String,
 machineName : String
);

Parameters

name
The short name that identifies the service to the system.
machineName
The computer on which the service resides.

Exceptions

Exception Type Condition
ArgumentException The name parameter is a null reference (Nothing in Visual Basic) or has length zero (0).

-or-

The machineName parameter syntax is invalid.

Remarks

For the machineName parameter, you can use "." to represent the local computer.

Requirements

Platforms: Windows NT Server 4.0, Windows NT Workstation 4.0, Windows 2000, Windows XP Home Edition, Windows XP Professional, Windows Server 2003 family

.NET Framework Security: 

See Also

ServiceController Class | ServiceController Members | System.ServiceProcess Namespace | ServiceController Constructor Overload List

Show: