You might be thinking, what "Invoke-History" does?
Actually it re-run the command which you run before running "Invoke-History", in simple words , this cmdlet executes the latest command which you run in PowerShell console.
In the above screenshot you can see, that it runs the last executed command. You might be thinking, it's not helpful, you can re-run the last run command by pressing UP-Arrow and then hit enter, yes you are right, But (Sorry! there is always a BUT!).
In my previous post, when we run the Get-History cmdlet and I had mentioned that in the out of the Get-History cmdlet the property ID is quite important, in Invoke-History you can use the -ID parameter to run the specific command which is stored in the History :D .
In the above screenshot the Invoke-History will execute the command which have the ID number 17 in History.
Cool! I am right ;)
Aman Dhally
If you like, you can follow me on Twitter and Facebook. You can also check my “You Tube” channel
for PowerShell video tutorials. You can download all of my scripts from “Microsoft
TechNet Gallery”.
No comments:
Post a Comment
Note: Only a member of this blog may post a comment.