-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathopschallenge10.ps1
68 lines (35 loc) · 1.54 KB
/
opschallenge10.ps1
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
# Script Name opschallenge10.ps1
# Author Bill Kachersky
# Date of last revision 08/06/2021
# Description of purpose Fun Tasks for Powershell
# BEGIN CHALLENGE
# Task 1 - Print to the terminal screen all active
# processes ordered by highest CPU time consumption at the top.
Get-Process | Sort-Object CPU -Descending
# Task 2 - Print to the terminal screen all active
# processes ordered by highest Process Identification Number at the top.
Get-Process | Sort-Object ID -Descending
# Task 3 - Print to the terminal screen the top five
# active processes ordered by highest Working Set (WS(K)) at the top.
Get-Process | Sort-Object WS -Descending | Select-Object -First 5
# Task 4 - Start the process Internet Explorer (iexplore.exe)
# and have it open https://owasp.org/www-project-top-ten/
Start-Process "iexplore" "https://owasp.org/www-project-top-ten/"
# Start the process Internet Explorer (iexplore.exe)
# ten times using a for loop. Have each instance
# open https://owasp.org/www-project-top-ten/.
# Loop Begin
for ($i = 1 ; $i -lt 11 ; $i++)
{
Start-Process "iexplore.exe" "https://owasp.org/www-project-top-ten/"
sleep 1
}
# End
# Close all Internet Explorer windows.
Get-Process "iexplore" | Stop-Process
# Kill a process by its Process Identification Number.
# Choose a process whose termination won’t destabilize
# the system, such as Internet Explorer or MS Edge.
Stop-Process -ID 25404
# (this was for notepad)
# END CHALLENGE