You are here:

WindowsManagement.com > PowerShell > PowerShell 1.0 > Add-History
ActiveXperts Network Monitor 2019 proactively manages network servers, devices, databases and more.

Add-History - PowerShell 1.0

Microsoft Windows PowerShell is a command-line shell and scripting tool based on the Microsoft .NET Framework. It is designed for system administrators, engineers and developers to control and automate the administration of Windows and applications.

More than hundred command-line tools (so called "cmdlets") can be used to perform system administration tasks and Windows Management Instrumentation (WMI). These cmdlets are easy to use, with standard naming conventions and common parameters, and standard tools for piping, sorting, filtering, and formatting data and objects.

Add-History


Description
Back up your Hyper-V VMs Easy & Fast. 100% built for Hyper-V. Free for 2 VMs, forever.

Usage


Options
-inputObject PSObject[]
        Adds the specified HistoryInfo objects to the session history. You can 
        use this parameter to submit a HistoryInfo object from Get-History, Imp
        ort-Clixml, or Import-Csv to Add-History.

    -passthru SwitchParameter
        Passes the object created by this cmdlet through the pipeline. 
        By default, this cmdlet does not pass any objects through the pipeline.

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

Example(s)
Export session history to a file :

C:\PS>get-history | export-csv E:\SessionHist.csv

Import session history from a file (this could be a different session on a different machine):

C:\PS>import-csv SessionHist.csv | add-history

You can also pipe commands directly from get-history to add-history which will re-arrange the order of items in the command line history. Piping history command (either from file or from get-history) to invoke-history will actullly run the commands.