Compartir a través de

PSHost.Name Property


Gets the hosting application's identification in some user-friendly fashion. This name can be referenced by scripts and cmdlets to identify the host that is executing them. The format of the value is not defined, but a short, simple string is recommended.

 abstract property System::String ^ Name { System::String ^ get(); };
 abstract property Platform::String ^ Name { Platform::String ^ get(); };
public abstract string Name { get; }
member this.Name : string
Public MustOverride ReadOnly Property Name As String

Property Value

The name identifier of the hosting application.


if ($Host.Name -ieq "ConsoleHost") { write-host "I'm running in the Console Host" }


In implementing this member, you should return some sort of informative string describing the nature your hosting application. For the default console host shipped by Microsoft this is ConsoleHost.

Applies to