Gets an object that represents the current host program. And, displays Windows PowerShell version and regional information by default. (Get-Host)

   

# NAME
Get-Host

# SYNOPSIS
Gets an object that represents the current host program. And, displays Windows PowerShell version and regional information by default.

# SYNTAX
Get-Host [<CommonParameters>]

# DESCRIPTION
The Get-Host cmdlet gets an object that represents the program that is hosting Windows PowerShell.

The default display includes the Windows PowerShell version number and the current region and language settings that the host is using, but the host object contains a wealth of information, including detailed information about the version of Windows PowerShell that is currently running and the current culture and UI culture of Windows PowerShell. You can also use this cmdlet to customize features of the host program user interface, such as the text and background colors.

# PARAMETERS
<CommonParameters>
This cmdlet supports the common parameters: Verbose, Debug,
ErrorAction, ErrorVariable, WarningAction, WarningVariable,
OutBuffer and OutVariable. For more information, type,
"get-help about_commonparameters".

# INPUTS
None
You cannot pipe input to this cmdlet.

# OUTPUTS
System.Management.Automation.Internal.Host.InternalHost
Get-Host returns a System.Management.Automation.Internal.Host.InternalHost object.

# NOTES

The $host automatic variable contains the same object that Get-Host returns, and you can use it in the same way. Similarly, the $PSCulture and $PSUICulture automatic variables contain the same objects that the CurrentCulture and CurrentUICulture properties of the host object contain. You can use these features interchangeably.

For more information, see about_Automatic_Variables.

# EXAMPLE 1

C:\PS>get-host

Name : ConsoleHost
Version : 2.0
InstanceId : e4e0ab54-cc5e-4261-9117-4081f20ce7a2
UI : System.Management.Automation.Internal.Host.InternalHostUserInterface
CurrentCulture : en-US
CurrentUICulture : en-US
PrivateData : Microsoft.PowerShell.ConsoleHost+ConsoleColorProxy
IsRunspacePushed : False
Runspace : System.Management.Automation.Runspaces.LocalRunspace

# Description
-----------
This command displays information about the Windows PowerShell console, which is the current host program for Windows PowerShell in this example. It includes the name of the host, the version of Windows PowerShell that is running in the host, and current culture and UI culture.

The Version, UI, CurrentCulture, CurrentUICulture, PrivateData, and Runspace properties each contain an object with very useful properties. Later examples examine these properties.

# EXAMPLE 2

C:\PS>$h = get-host

C:\PS> $win = $h.ui.rawui.windowsize

C:\PS> $win.height = 10

C:\PS> $win.width = 10

C:\PS> $h.ui.rawui.set_windowsize($win)

# Description
-----------
This command resizes the Windows PowerShell window to 10 pixels by 10 pixels.

# EXAMPLE 3

C:\PS>(get-host).version | format-list -property *

Major : 2
Minor : 0
Build : -1
Revision : -1
MajorRevision : -1
MinorRevision : -1

# Description
-----------
This command gets detailed information about the version of Windows PowerShell running in the host. You can view, but not change, these values.

The Version property of Get-Host contains a System.Version object. This command uses a pipeline operator (|) to send the version object to the Format-List cmdlet. The Format-List command uses the Property parameter with a value of all (*) to display all of the properties and property values of the version object.

# EXAMPLE 4

C:\PS>(get-host).currentculture | format-list -property *

Parent : en
LCID : 1033
KeyboardLayoutId : 1033
Name : en-US
IetfLanguageTag : en-US
DisplayName : English (United States)
NativeName : English (United States)
EnglishName : English (United States)
TwoLetterISOLanguageName : en
ThreeLetterISOLanguageName : eng
ThreeLetterWindowsLanguageName : ENU
CompareInfo : CompareInfo - 1033
TextInfo : TextInfo - 1033
IsNeutralCulture : False
CultureTypes : SpecificCultures, InstalledWin32Cultures, FrameworkCultures
NumberFormat : System.Globalization.NumberFormatInfo
DateTimeFormat : System.Globalization.DateTimeFormatInfo
Calendar : System.Globalization.GregorianCalendar
OptionalCalendars : {System.Globalization.GregorianCalendar, System.Globalization.GregorianCalendar}
UseUserOverride : True
IsReadOnly : False

# Description
-----------
This command gets detailed information about the current culture set for Windows PowerShell running in the host. This is the same information that is returned by the Get-Culture cmdlet.

(Similarly, the CurrentUICulture property returns the same object that Get-UICulture returns.)

The CurrentCulture property of the host object contains a System.Globalization.CultureInfo object. This command uses a pipeline operator (|) to send the CultureInfo object to the Format-List cmdlet. The Format-List command uses the Property parameter with a value of all (*) to display all of the properties and property values of the CultureInfo object.

# EXAMPLE 5

C:\PS>(get-host).currentculture.DateTimeFormat | format-list -property *

AMDesignator : AM
Calendar : System.Globalization.GregorianCalendar
DateSeparator : /
FirstDayOfWeek : Sunday
CalendarWeekRule : FirstDay
FullDateTimePattern : dddd, MMMM dd, yyyy h:mm:ss tt
LongDatePattern : dddd, MMMM dd, yyyy
LongTimePattern : h:mm:ss tt
MonthDayPattern : MMMM dd
PMDesignator : PM
RFC1123Pattern : ddd, dd MMM yyyy HH':'mm':'ss 'GMT'
ShortDatePattern : M/d/yyyy
ShortTimePattern : h:mm tt
SortableDateTimePattern : yyyy'-'MM'-'dd'T'HH':'mm':'ss
TimeSeparator : :
UniversalSortableDateTimePattern : yyyy'-'MM'-'dd HH':'mm':'ss'Z'
YearMonthPattern : MMMM, yyyy
AbbreviatedDayNames : {Sun, Mon, Tue, Wed...}
ShortestDayNames : {Su, Mo, Tu, We...}
DayNames : {Sunday, Monday, Tuesday, Wednesday...}
AbbreviatedMonthNames : {Jan, Feb, Mar, Apr...}
MonthNames : {January, February, March, April...}
IsReadOnly : False
NativeCalendarName : Gregorian Calendar
AbbreviatedMonthGenitiveNames : {Jan, Feb, Mar, Apr...}
MonthGenitiveNames : {January, February, March, April...}

# Description
-----------
This command returns detailed information about the DateTimeFormat of the current culture that is being used for Windows PowerShell.

The CurrentCulture property of the host object contains a CultureInfo object that, in turn, has many useful properties. Among them, the DateTimeFormat property contains a DateTimeFormatInfo object with many useful properties.

To find the type of an object that is stored in an object property, use the Get-Member cmdlet. To display the property values of the object, use the Format-List cmdlet.

# EXAMPLE 6

C:\PS>(get-host).ui.rawui | format-list -property *

ForegroundColor : DarkYellow
BackgroundColor : DarkBlue
CursorPosition : 0,390
WindowPosition : 0,341
CursorSize : 25
BufferSize : 120,3000
WindowSize : 120,50
MaxWindowSize : 120,81
MaxPhysicalWindowSize : 182,81
KeyAvailable : False
WindowTitle : Windows PowerShell 2.0 (04/11/2008 00:08:14)

# Description
-----------
This command displays the properties of the RawUI property of the host object. By changing these values, you can change the appearance of the host program.

# EXAMPLE 7

C:\PS>(get-host).ui.rawui.backgroundcolor = "Black"

C:\PS> cls

# Description
-----------
These commands change the background color of the Windows PowerShell console to black. The "cls" command is an alias for the Clear-Host function, which clears the screen and changes the whole screen to the new color.

This change is effective only in the current session. To change the background color of the console for all sessions, add the command to your Windows PowerShell profile.

# EXAMPLE 8

C:\PS>$host.privatedata.errorbackgroundcolor = "white"

# Description
-----------
This command changes the background color of error messages to white.

This command uses the $host automatic variable, which contains the host object for the current host program. Get-Host returns the same object that $host contains, so you can use them interchangeably.

This command uses the PrivateData property of $host as its ErrorBackgroundColor property. To see all of the properties of the object in the $host.privatedata property, type "$host.privatedata | format-list * ".

RELATED LINKS
Online version: http://go.microsoft.com/fwlink/?LinkID=113318
Read-Host
Out-Host
Write-Host

C:\Windows>powershell get-help Get-Member -full

ColorConsole [Version 1.7.1000] PowerShell 2.0-Export
Microsoft Windows [Version 6.1.7600]
Copyright (c) 2014 Microsoft Corporation.

OS: Windows-10 / Windows-8.1 & 8 / Windows-7 & Vista / Windows Server 2008-2016
»»»» ColorConsole



 


... Home  
... Impressum
... ColorConsole

... CMD
... Netsh-XP
... Netsh-7
... Netsh-Vista
... Powershell









Download the Windows 7 Starter, Home (Basic Premium), Professional und Ultimate!

... facebook.de
0.078
How can I uninstall the MultiClipBoardSlots!  / Der Remote Desktop Port bei Windows?  / Folders expand too quickly at drag over, in Tree-View?  / Connect a Bluetooth enabled device to Windows 10 computer, how to?  / Warum sind bei Vista keine Desktopverknüpfungen möglich?  / Hilfe, hab Probleme beim Umstellen von "XP Outlook Express" nach "Windows 7 Live Mail"!  / How can I minimize the other programs to tray, with this Freeware?  / Folder, Directory?  / Wie kann ich das DirectX-Diagnoseprogramm in Windows 8 (8.1, 10) 64/32 bit starten (version, finden, öffnen)?  / How to find the calculator in Windows 8 and 8.1 (open, start, run)?  / Kann ich x86 Anwendung bei einem x64 Prozessor einsetzen?  / Nintendo DSi oder DS Lite, was soll ich kaufen?  /