- There’s one particular command that allows you output anything from shell to file, find that command and use with any commands like Get-Service or Get-Process. Does it behave differently than Export-CSV?
- Programs often use CSV but don’t use comma for delimiter – try to exporting to CSV but change the delimiter
- Can you print directly from shell? See if there are any commands available and if so, print some Event Logs!
Notes from the lesson
# Connects multiple commands into one
# Output from former command is sent to latter
#Some examples we've been using so far
get-service wuauserv,bits | Stop-Service
get-service wuauserv,bits |Start-Service
get-process -name notepad | Stop-Process
Get-EventLog -LogName Application -Newest 10 -EntryType Error | Export-Csv -Path .\eventlogs.csv
# You might have noticed there's more information in CSV than in the output screen, that's by design.
# Outputting to shell often has special formatting to limit the amount of output due to better redability
Get-Service | FT *
#FT is an alias for Format-Table. We will talk about aliases and formatting output later on in the course, however when convenient I'll let you know the alias know
# Why pipeline works? It's because it's an object
# We have properties and methods
Get-Service | GM #GM Stands for Get-Member
# Show that both commands use the same service type
Help Get-Service -full
Help Stop-Service -full
# Pipeline is not only limited to matching by type, it will try match property names, types etc.