-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathGet-Command.ps1
More file actions
50 lines (32 loc) · 907 Bytes
/
Get-Command.ps1
File metadata and controls
50 lines (32 loc) · 907 Bytes
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
Get-Command
get-help
Get-Member
Restart-Service -DisplayName spooler
get-process | where-object name -like *notepad* |stop-process -Force
$var = "cat"
$var = 10
#Do not have to do this
[string]$var = "cat"
$var | Get-Member
-eq Equal
-NE not equal
-gt greater than
-lt less than
-ge greater than equal to
-le less than equal to
-like
-match
-and
-or
#go here for more info https://learn.microsoft.com/en-us/powershell/module/microsoft.powershell.core/about/about_comparison_operators?view=powershell-7.4
$planets = "earth","mars",'Saturn',"earth"
$planets | ForEach-Object {Write-Output $_}
# starting to itterate through my array
$Currentvalue = 0 # starting my counter at zero so I know what index i am at
foreach ($p in $planets){
write-output $p
Write-Output "The current positon in the array is $currentvalue"
$currentvalue = $currentvalue + 1
}
'$planets'
"$planets"