-
Notifications
You must be signed in to change notification settings - Fork 0
/
Aliases.ps1
71 lines (45 loc) · 1.13 KB
/
Aliases.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
69
70
71
#Aliases
Get-Alias
Get-Alias -name *a
Test-Path $profile
New-Item -path $profile -ItemType file -force
Get-Variable profile | Format-List
Set-Alias listit GetChildren
Get-Alias | fl | more
Get-Command -noun alias
Get-PSProvider
Import-Module activedirectory
Import-Module sqlps #sql server powershell provider
Set-Location ad:
Set-Location C:
Get-PSDrive
Get-Command -name item
#Object Members
Get-Service -name winrm | get-member #get member type and properties
Get-Process | Get-Member
Get-Process -name spooler
Get-Service -DisplayName "print spooler"
$s = Get-Service -name spooler
$s
$s.Start()
$s.Refresh()
Set-Alias showme Get-ChildItem
showme
$services = Get-Service RemoteRegistry, EventLog
foreach($service in $services)
{
$filter = "Name = '$($service.Name)'"
Get-WmiObject -Class win32_service -Filter $filter
}
$admins = Get-LocalGroupMember administrators
foreach($admin in $admins)
{
Get-LocalUser -SID $admin.SID
}
Get-Help Get-LocalUser -Examples
$admins = Get-LocalGroupMember administrators | Select-Object Name, SID
$admins
foreach($admin in $admins)
{
Get-LocalUser -SID $admin.SID
}