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 _
public ServiceController(
   string name,
 string machineName
public: ServiceController(
   String* name,
 String* machineName
public function ServiceController(
   name : String,
 machineName : String


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


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


The machineName parameter syntax is invalid.


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


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