The code for history2.txt is: Id Duration CommandLine -- -------- ----------- 1 0.003 foreach ($a in $array) {… 2 0.001 $array = 1..10 3 0.033 foreach ($a in $array) {… 4 0.014 $sum = 0 5 0.020 foreach ($a in $array) {… 6 0.011 Write-Output "The sum of `$array is $sum." 7 0.049 Get-ChildItem | ForEach-Object {$_.name} 8 0.083 Get-ChildItem | gm 9 0.117 Get-ChildItem | ForEach-Object {… 10 0.052 Get-ChildItem -Path ~\Documents\CST1861\Week | ForEach-Object {… 11 0.049 Get-ChildItem -Path ~\Documents\CST1861\Week\14 | ForEach-Object {… 12 0.028 Get-ChildItem -Path ~\Documents\CST1861\Week\14 | ForEach-Object {… 13 0.031 Get-ChildItem -Path ~\Documents\CST1861\Week\14 | ForEach-Object {… 14 0.036 Get-ChildItem -Path ~\Documents\CST1861\Week\14 | ForEach-Object {… 15 0.023 Get-ChildItem -Path ~\Documents\CST1861\Week\14 | ForEach-Object {… 16 0.037 $array | ForEach-Object {… 17 0.061 ls 18 0.024 Get-ChildItem 19 0.027 dir 20 10.095 1..5 | ForEach-Object {Write-Output $_; start-sleep -Seconds 2} 21 0.182 Measure-Command 1..5 | ForEach-Object {Write-Output $_; start-sleep -Seconds 2} 22 10.103 Measure-Command {1..5 | ForEach-Object {Write-Output $_; start-sleep -Seconds 2}} 23 2.163 Measure-Command {1..5 | ForEach-Object -Parallel {Write-Output $_; start-sleep -Seconds 2}} 24 4.233 Measure-Command {1..10 | ForEach-Object -Parallel {Write-Output $_; start-sleep -Seconds 2}} 25 0.013 $n=1 26 0.026 While ($n -le 10){… 27 0.001 $n=1 28 0.017 While ($n -le 10){… 29 0.009 While ($n -le 10){Write-Output $n $n++ } 30 0.001 $n=1 31 0.023 While ($n -le 10){Write-Output $n; $n++ } 32 0.011 While ($n -le 10){Write-Output $n; $n++ } 33 0.010 $n 34 0.009 $n=5 35 0.004 While ($n -le 10){Write-Output $n; $n++ } 36 0.017 $date = get-date 37 0.021 do {… 38 0.018 $date 39 0.001 $date = get-date 40 0.005 $date 41 0.001 $date = get-date 42 0.013 $date = $date.AddMonths(1) 43 0.013 $date 44 0.013 do {… 45 0.001 $n=1 46 0.000 do {… 47 0.001 $n=1 48 0.017 do {… 49 0.001 $n 50 0.001 While ($n -le 10){Write-Output $n; $n++ } 51 0.001 do {… 52 0.001 $n 53 0.043 $items = Get-ChildItem -Path ~\Documents\CST1861\Week\13= 54 0.010 $items = Get-ChildItem -Path ~\Documents\CST1861\Week\13 55 0.026 foreach ($i in $items){Write-Output "The character length of $i is "($i).Length} 56 0.017 $Process = "notepad" 57 0.055 do {… 58 0.053 history > history1.txt 59 0.077 start-process notepad 60 0.235 get-process 61 0.001 $Process = "notepad" 62 9.176 do {… 63 0.004 do {… 64 0.090 $Error 65 0.036 $Error[0] 66 0.388 get-help 67 0.026 cd ~\Documents\CST1861\Week\14 68 0.303 get-help about_automatic_variables > about_automatic_variables.txt 69 0.112 New-PsSession -ComputerName SRV01 -ErrorVariable a 70 0.022 $a 71 0.039 New-PsSession -ComputerName SRV01 -ErrorVariable +a 72 0.029 $a 73 0.028 $error[0] 74 0.058 $error 75 0.062 Get-Service -Name BITS,Nobody,WinRM 76 0.017 $ErrorActionPreference 77 0.043 Get-Service -Name Foo,BITS,Nobody,WinRM -ErrorAction Continue 78 0.019 Get-Service -Name Foo,BITS,Nobody,WinRM -ErrorAction Stop 79 0.014 Get-Service -Name BITS,Foo,Nobody,WinRM -ErrorAction Stop 80 0.023 Get-Service -Name BITS,Foo,Nobody,WinRM -ErrorAction SilentlyContinue 81 0.043 Get-Service -Name BITS,Foo,Nobody,WinRM 82 0.002 $ErrorActionPreference 83 0.010 $computer = 'Srv01' 84 0.010 Write-Verbose "Connecting to $computer" 85 0.016 $session = New-PSSession -ComputerName $computer -ErrorAction Stop 86 0.012 $computer = 'DESKTOP-46AVB2C' 87 2.097 $session = New-PSSession -ComputerName $computer -ErrorAction Stop 88 0.016 $computers = 'Srv01','DC01','localhost' 89 0.025 foreach ($computer in $computers) {… 90 0.030 $a 91 0.015 $a = '' 92 0.031 $session = New-PSSession -ComputerName $Computer -ErrorVariable +a 93 0.019 $a 94 0.001 $a = '' 95 1.300 $session = New-PSSession -ComputerName $computers -ErrorVariable +a 96 0.014 $a 97 0.048 get-pssession 98 0.084 try { blahfoo }… 99 1.392 try {… 100 1.356 try {… 101 0.035 $a 102 0.014 try {… 103 0.016 try {… 104 0.009 $cmderrors 105 0.036 $session = New-PSSession -ComputerName -Error SilentlyContinue $computers -ErrorVariable +cmderrors 106 0.021 try {… 107 0.001 $cmderrors 108 0.024 $session = New-PSSession -ComputerName -ErrorAction SilentlyContinue $computers -ErrorVariable +cmder… 109 1.319 try {… 110 0.027 $cmderrors 111 0.011 Write-Warning "Warning: An error occurred, look at `$cmderrors for a list." 112 0.092 cls 113 1.329 try {… 114 1.312 try {… 115 0.025 $cmderrors 116 0.020 $computers = 'Srv01','ooga','localhost' 117 1.233 try {… 118 0.020 $cmderrors 119 0.074 cls 120 1.331 try {… 121 0.011 Write-Warning "Warning: An error occurred, look at `$cmderrors for a list."; 122 0.040 $cmderrors 123 1.401 try {… 124 0.072 try { blahfoo }… 125 0.015 $computers = 'localhost','Srv01','ooga' 126 1.264 try {… 127 1.320 try {… 128 0.091 `$cmderrors = '' 129 1.314 $session = New-PSSession -ComputerName $computers -ErrorAction SilentlyContinue -ErrorVariable +cmder… 130 0.007 $cmderrors = '' 131 2.131 $session = New-PSSession -ComputerName $computers -ErrorAction SilentlyContinue -ErrorVariable +cmder… 132 0.017 if ( $cmderrors -ne '' )… 133 0.018 $cmderrors 134 0.004 $cmderrors = '' 135 1.278 $computers | ForEach-Object {… 136 0.001 $cmderrors = '' 137 1.314 $computers | ForEach-Object {… 138 0.027 $cmderrors 139 0.001 Write-Warning "Warning: An error occurred, look at `$cmderrors for a list."; 140 0.009 $computer 141 0.001 $computer = 'DESKTOP-46AVB2C' 142 1.950 try {… 143 0.011 $computer = 'ooga' 144 0.026 try {… 145 0.033 try {… 146 0.030 $a 147 0.001 $computer 148 0.000 $a = '' 149 0.043 try {… 150 0.064 try { blahfoo }… 151 0.033 try { $session = New-PSSession -ComputerName $computer }… 152 0.007 $session 153 0.010 Function Get-PCUpTime {… 154 0.025 Get-PCUpTime 155 0.056 Get-PCUpTime ooga 156 0.035 Get-PCUpTime ooga localhost 157 0.034 Get-PCUpTime localhost,ooga 158 0.039 Get-PCUpTime ooga,localhost 159 0.014 Get-PCUpTime ooga,localhost 160 0.008 Function Get-PCUpTime {… 161 0.009 Get-PCUpTime ooga,localhost 162 0.018 Get-PCUpTime localhost,ooga 163 0.001 Function Get-PCUpTime {… 164 0.052 Get-PCUpTime localhost,ooga 165 0.017 Get-PCUpTime ooga,localhost 166 0.021 Function Get-PCUpTime {… 167 0.034 Get-PCUpTime ooga,localhost 168 0.001 Function Get-PCUpTime {… 169 0.016 Get-PCUpTime ooga,localhost 170 0.023 Get-PCUpTime localhost,ooga