• Narrow screen resolution
  • Wide screen resolution
  • Increase font size
  • Decrease font size
  • Default font size
  • default color
  • red color
© Diana Scherff, Amas-Veritas.com

Welcome to Amas Veritas [dot] com

Updates: Media (lyrics) has a new layout. I could never figure out how to lay it out, but it's easier to navigate now. I'm still working on a better duplicate Mamblog mod. I'm trying to make submittions easier but the poetry form died for some reason. Quizzes are also on their way from the old site. Joomla content isn't very code friendly so I'm having to rewrite old code. You can still click on News > AH v21 > Screen if you wish to use the quizzes.
 
Home arrow Tools arrow Windows PowerShell arrow Get-History [ghy]
Get-History [ghy] Print E-mail
Written by Diana, on 04-09-2007 01:21
Views 49
Favoured None

PS C:\Users\Admin> help ghy -full

NAME
    Get-History

SYNOPSIS
    Gets a list of the commands entered during the current session.

SYNTAX
    Get-History [[-id] <long[]>] [[-count] <int>] [<CommonParameters>]


DETAILED DESCRIPTION
    The Get-History cmdlet gets the session history, that is, the list of commands entered during the current session. Windows PowerShell automatically maintains a history of each session. You can save the session history in XML or CSV format. By default, history files are saved in the home directory, but you can save the file in any location.


PARAMETERS
    -id <long[]>
        Specifies the ID number of a command in the session history. Get-History gets only the specified command. If you use Id and Count, Get-History gets the most recent commands ending with the command specified by the Id parameter.

        Required?                    false
        Position?                    1
        Default value                Immediate ID Predecessor
        Accept pipeline input?       true (ByValue)
        Accept wildcard characters?  false

    -count <int>
        Displays the specified number of most-recent history entries. The default is 32. If you use both Count and Id in a command, the display ends with the command specified by Id.

        Required?                    false
        Position?                    2
        Default value                32
        Accept pipeline input?       false
        Accept wildcard characters?  false

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


INPUT TYPE
    None


RETURN TYPE
    HistoryInfo objects


NOTES


        For more information, type "Get-Help Get-History -detailed". For technical information, type "Get-Help Get-History -full".

        The session history is a list of the commands entered during the session, along with the ID, which represents the order of execution, the status, and start and end times of the command. As you enter each command, Windows PowerShell adds it to the history so that you can reuse it.

        By default, the history can hold 64 commands, but you can change it by changing the value of the $MaximumHistoryCount variable. When the history is full, the oldest command entries are deleted to make room for new ones.

        You cannot clear the session history except by ending the Windows PowerShell session.

        Commands are added to the history when the command finishes executing, not when it's entered. If commands take some time to complete, or are executing in a nested prompt (which complete only when you exit from the prompt level), they might appear to be out of order in the history.

        In addition to using the Get-History command, you can navigate within the session history by using the up-arrow and down-arrow keys. For more information about the session history, type "get-help about_history".

        When specifying multiple values for a parameter, use commas to separate the values. For example, "<parameter-name> <value1>, <value2>".

        You can also refer to Get-History by its built-in aliases, "h", "history" and "ghy". For more information, see About_Alias.


    ----------------- EXAMPLE 1 -----------------

    C:\PS>get-history


    This command gets the 32 most recently submitted commands. The default display shows each command and its ID, which indicates the order of execution.





    ----------------- EXAMPLE 2 -----------------

    C:\PS>get-history | where-object {$_.commandLine -like "*service*"}


    This command gets entries from the command history that include the word, "service". The first command gets the 32 most recent entries in the session history. The pipeline operator (|) passes the results to the Where-Object cmdlet, which selects only the commands that include "service".





    ----------------- EXAMPLE 3 -----------------

    C:\PS>get-history -id 7 -count 5 | export-csv history.csv


    This command gets the 5 most recent history entries ending with entry 7. The pipeline operator (|) passes the result to the Export-Csv cmdlet, which formats the history as comma-separated text and saves it in the History.csv file. The file includes the data that is displayed when you format the history as a list, including the status and start and end times of the command.





    ----------------- EXAMPLE 4 -----------------

    C:\PS>get-history -count 1


    This command gets the last (most recently entered) command in the command history. It uses the Count parameter to display just one command. By default, Get-History displays the most recent commands. This command can be abbreviated to "h -c 1" and is equivalent to pressing the up-arrow key.





    ----------------- EXAMPLE 5 -----------------

    C:\PS>get-history -count $MaximumHistoryCount


    This command displays all of the commands saved in the session history. By default, $MaximumHistoryCount is 64, so this command can be abbreviated as "h -c 64".





    ----------------- EXAMPLE 6 -----------------

    C:\PS>get-history | format-list


    This command displays all of the properties of entries in the session history. The pipeline operator (|) passes the result to the format list command, which displays all of the properties of each history entry, including the ID, status, and start and end times of the command.






RELATED LINKS
    Invoke-History
    Add-History


Last update: 04-09-2007 01:21

Published in : Tools, Windows PowerShell

Users' Comments (0) RSS feed comment

No comment posted

Add your comment



mXcomment 1.0.4 © 2007-2008 - visualclinic.fr
License Creative Commons - Some rights reserved
 
< Prev   Next >




Double click any word on this page for a definition.
Using Firefox? Enable definitions by downloading the extension.
Sorry, this feature does not currently work in Opera or Safari.

No Users Online

Statistics

OS: FreeBSD
PHP: 5.2.1
MySQL: 4.1.21-log
Time: 13:14
Caching: Disabled
GZIP: Disabled
Members: 32
News: 2445
Web Links: 39
Visitors: 993228

Syndicate

Login

Particls