Powershell Flashcards
Redirect the output of a file
dir c:\file1 > file2
File1»_space; file2
Display a directory
Get-childitem-directory
dir
Ls
Display history
Get-history
H
ghy
Create a new file
New-item
Note pad file1
Leafpad file1
What command displays only directorys
Get-childitem -directory
Copy commands
Copy-item file1.txt ./dir1/
Copy file1.txt ./dir1/file1.txt
Cp file1 ./dir1/
Add and remove a permission
attrib +h file1
attrib -h file1
What are the permissions switches
N deny all access F allow full access M modify access RX read/ execute access R read only W wright only D remove user or group for no access
Display command in GUI
Show-command
Change a file property
Set-itemproperty file1.txt -name isReasOnly -value $false
Set-itemproperty file1.txt -name isReasOnly -value $true
Stride threat model
Spoofing Tampering with data Repudiation Information disclosure Denial of service Elevation of services
Authentication vs Authorization
Authentication is (who you are) verifying the identity of the user and authorization is (what you can do) determining users access privileges
Get help
Get-help *
Get-help get-acl
Help command
Execute your profile
Set-executionPolicy remoteSigned Or Get execution Set execution RemoteSigned
Get a list of all the commands
Get-command | more
Create a link
Mklink targetFile.bak sourceFile.txt
Count things in a file
Get-content file1 | measure-object
- line
- character
- word
Start an instance of notepad
Start-process notepad
Cancel a process
Get-process -name notepad
Stop-process processID
Sort by stuff
Get-content file1 | sort -descending
Display all environment variables
Echo $env:path; $env:computername
How can an admin see all aliases?
Get-alias | more
String operators
- eq equals
- ne not equal
- le less then or equal
- ge greater then or equal
- lt less the.
- gt greater then
- like wildcard for strings
- not like wildcard comparison 4 string
Display not duplicates
Get-content file1 | get-unique
What does acl stand for?
Access control list
Find the value of a variable
Get-variable -name value