Powershell 6 Flashcards
What 3 commands would:
show only the service BITS
Stop the service BITs
Start the service BITS
get-service -name bits
stop-service -name bits
start-service -name bits
What parameter would you use at the end of ‘start-service -name BITS’ to display the result of the command straight away?
-passthru
start-service -name BITS -passthru
What command would export the results of get-service to a csv file and save it to c:\ ? In your example call the csv file service.csv
get-service | export-csv c:\service.csv
What command would import a csv file called services.csv to be to be displayed on the screen?
path of file c:\services.csv
import-csv c:\services.csv
when pulling information such as get-command from powershell we can ‘export’ and we can ‘convertto’. What is the basic difference between these two commands?
Export converts and outputs to a location
convertto just converts and keeps the information there in case you want to use the pipeline to move it over and manipulate it in some way.
Once you use export you are done with the information. You have to send it out to a file.
What parameter would you use at the end of a command so that the command doesn’t run, but instead it will tell you what would happen if you ran the command?
-whatif
stop-service -name BITS -whatif
What parameter would you use at the end of a command so that the command asks you to confirm yes or no whether you want to run it?
-confirm
stop-service -name BITS -confirm
What does thepipeline acually do?
The pipeline allows you to set a command and then move the results over (the pipeline) to manipulate with another command.
This way you can use several commands and several pipeline to tell powershell to do this, then do this, and then do this…
What two things does an Object consist of? Describe what each things is
An object consists of Properties and Methods.
If a guitar is an object. The propertoes are the strings, the machime heads, the bridge, the tremelo arm etc…..
If an object is a guitar. the methods are what you can do to it. You can play it, you can tune it, You can re-string it, you can re-fret it.
How do you write equals in powershell?
-eq
How do you qrite greater than in Powershell?
-gt