Get-History is the command which can be used to find the commands executed in the current session.
PS C:\Users\admin> Get-History
Id CommandLine
-- -----------
1 $arr=@()
2 $arr += "ABC"
3 $arr += "XYZ"
4 $arr += "PQR"
5 $arr[0]
6 $arr[1]
7 $arr[2]
8 $arr[3]
9 $arr.count
10 for ($x=0; $x -lt $arr.count; $x++) { echo ${arr}[$x] }
11 dir
12 Get-Counter
13 Get-EventLog
14 get-help
PS C:\Users\admin> Get-History
Id CommandLine
-- -----------
1 $arr=@()
2 $arr += "ABC"
3 $arr += "XYZ"
4 $arr += "PQR"
5 $arr[0]
6 $arr[1]
7 $arr[2]
8 $arr[3]
9 $arr.count
10 for ($x=0; $x -lt $arr.count; $x++) { echo ${arr}[$x] }
11 dir
12 Get-Counter
13 Get-EventLog
14 get-help
https://connect.microsoft.com/PowerShell/feedback/details/534286/enable-command-history-between-sessions now between sessions. Ctrl+R
ReplyDelete