Process.MachineName Property

 

Gets the name of the computer the associated process is running on.

Namespace:   System.Diagnostics
Assembly:  System (in System.dll)

[<BrowsableAttribute(false)>]
member MachineName : string with get

Property Value

Type: System.String

The name of the computer that the associated process is running on.

Exception Condition
InvalidOperationException

There is no process associated with this Process object.

You can view statistical data and process information for processes running on remote computers but you cannot call Start, CloseMainWindow, or Kill on remote computers.

System_CAPS_noteNote

When the associated process is executing on the local machine, this property returns a period (".") for the machine name. You should use the Environment.MachineName property to get the correct machine name.

To use the following example you must first start at least one instance of Notepad on a remote computer. The example requests the name of the remote computer on which Notepad is running, and then displays the respective ProcessName, Id, and MachineName properties for each instance.

No code example is currently available or this language may not be supported.

LinkDemand

for full trust for the immediate caller. This member cannot be used by partially trusted code.

.NET Framework
Available since 1.1
Return to top
Show: