-
Notifications
You must be signed in to change notification settings - Fork 0
/
PowershellBasics.ps1
60 lines (31 loc) · 1.4 KB
/
PowershellBasics.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
Get-Command -Verb Get -Noun *DNS*
help -Name Get-Command -Detailed
Get-Help -Name *DNS*
Help about* | more
Get-Service -Name P* -RequiredServices
Get-Service P* -Req
Get-Alias -Name Get-S*
Get-Alias -Name G* | Format-Table Name, Definition
Get-Alias -Definition *Service*
Get-NetIPAddress | Format-Table
Get-Service | Where-Object Status -EQ "Stopped" | Start-Service
Get-Command -Verb Get -Noun *DNS*
(Get-Service | Where-Object Status -EQ "Stopped" | Select-Object Name, Status).count
Get-Variable -Name P*
Get-ChildItem ENV: | more #Get all env variables from the system
Write-Output "The name of the computer is $ENV:COMPUTERNAME"
Write-Output The name of the computer is $ENV:COMPUTERNAME | Get-Member
$credential = Get-Credential
$credential | Get-Member
Get-Command -Name get-*Fire*
help Get-NetFirewallRule -Examples
Get-NetFirewallRule -Name *RemoteDesktop* | Format-Table #FT is Format-Table
Get-NetFirewallRule -Name *RemoteDesktop*
| Set-NetFirewallRule -Enabled 'True' -Whatif # whatif will tell what this command did when it ran
Get-Command | Where-Object {$_.Definition -Like "*Whatif*"}
get-module -ListAvailable | Select-Object -Property name
Get-Module -ListAvailable | Select-Object -Property Name | ConvertTo-Xml | Out-File module.html
Import-Module -Name ActiveDirectory | Get-Member
Get-Module -name activedirectory | Get-Member
Get-ChildItem ENV:
Get-Module -ListAvailable