Contact Info

Crumbtrail

ActiveXperts.com » Administration » Powershell » Powershell 1.0 » Invoke-History

Invoke-History - Powershell 1.0 CmdLet

ActiveXperts Network Monitor ships with integrated Powershell scripts to monitor complex network. The scripts run out of the box
Download the ActiveXperts Network Monitor FREE version now »

Invoke-History

Description
Invoke a previously executed Cmdlet

Usage
Invoke-History [[-iD] string] [-whatIf] [-confirm] [CommonParameters]

Options
-iD The ID number or the first few characters of a command
       from the session history.
	   
   -whatIf
       Describe but dont actually execute the command.

   -confirm
       Prompt for confirmation before executing the command.

   CommonParameters:
       -Verbose, -Debug, -ErrorAction, -ErrorVariable, -OutVariable.

Example(s)
Run the last (most recent) command:

PS C:\>r

Run the most recent get- command in the session history:

PS C:\>invoke-history get-

Run commands 5 - 15 and 17: (separate multiple IDs with commas)

PS C:\>invoke-history (5..15), 17