filmov
tv
GET STARTED WITH POWERSHELL: #1 CMDLETS
![preview_player](https://i.ytimg.com/vi/v_w8nQUJNSU/maxresdefault.jpg)
Показать описание
Thank you for watching my first Get Started with Powershell video. This video covers how to find what commands are available and getting help on how to run them.
For regular updates on my upcoming videos:
Follow me on twitter @dbainpink
Powershell uses commands called "cmdlets". Cmdlets are a set of lightweight commands that allow us to do things like get information or carry out tasks on objects on our local or remote machine.
Example 1: Find out what commands are available
Run:
Get-Command
This will bring back the cmdlets available.
Cmdlets are in the Verb-Noun format (The left part is the verb, the right part is the noun).
To filter these out we can search through them by specifying if we are searching the Verb part or the Noun part of the cmdlet. Here's an example:
Example 2: Bring back all cmdlets for a service.
Run:
Get-Command -Noun Service
You'll get the following results:
Get-Service
Start-Service
Stop-Service
And so on. ..
Example 3: Using a Wildcard to Search.
In this example we'll get all the cmdlets where there is a "G" in the Verb part.
Run:
Get-Command -Verb G*
These are the results
Get-Process
Get-Service
And so on.....
To get a list of the services on my local machine, I run the Get-Service cmdlet displayed above.
This has brought back all the services on my local machine.
Example 4: Getting Help on Cmdlets
To find out more information on what a cmdlet can do, we can run the Get-Help cmdlet.
Run:
Get-Help Get-Service
A synopsis of what the cmdlet does is displayed along with syntax on how to run it and more.
Example 5: Getting Examples on how to run specific cmdlets
If you are unsure how to execute a cmdlet so it does what you want it to, ask for examples:
Run:
Get-Help Get-Service -Examples
This will bring back examples of the code that needs to be run to get what you want from the Get-Service cmdlet.
It is a mandatory feature of Powershell that every cmdlet must have examples.
Example 6: Getting Help Online
Run:
Get-Help Get-Service -Online
This will take us to our browser and open up msdn where there is more information on the cmdlet.
And finally, to clear your screen, run:
Clear
or...
Cls
Notice these are not in the Verb-Noun format? That's because these are aliases and we'll be covering aliases in the next session.
For regular updates on my upcoming videos:
Follow me on twitter @dbainpink
Powershell uses commands called "cmdlets". Cmdlets are a set of lightweight commands that allow us to do things like get information or carry out tasks on objects on our local or remote machine.
Example 1: Find out what commands are available
Run:
Get-Command
This will bring back the cmdlets available.
Cmdlets are in the Verb-Noun format (The left part is the verb, the right part is the noun).
To filter these out we can search through them by specifying if we are searching the Verb part or the Noun part of the cmdlet. Here's an example:
Example 2: Bring back all cmdlets for a service.
Run:
Get-Command -Noun Service
You'll get the following results:
Get-Service
Start-Service
Stop-Service
And so on. ..
Example 3: Using a Wildcard to Search.
In this example we'll get all the cmdlets where there is a "G" in the Verb part.
Run:
Get-Command -Verb G*
These are the results
Get-Process
Get-Service
And so on.....
To get a list of the services on my local machine, I run the Get-Service cmdlet displayed above.
This has brought back all the services on my local machine.
Example 4: Getting Help on Cmdlets
To find out more information on what a cmdlet can do, we can run the Get-Help cmdlet.
Run:
Get-Help Get-Service
A synopsis of what the cmdlet does is displayed along with syntax on how to run it and more.
Example 5: Getting Examples on how to run specific cmdlets
If you are unsure how to execute a cmdlet so it does what you want it to, ask for examples:
Run:
Get-Help Get-Service -Examples
This will bring back examples of the code that needs to be run to get what you want from the Get-Service cmdlet.
It is a mandatory feature of Powershell that every cmdlet must have examples.
Example 6: Getting Help Online
Run:
Get-Help Get-Service -Online
This will take us to our browser and open up msdn where there is more information on the cmdlet.
And finally, to clear your screen, run:
Clear
or...
Cls
Notice these are not in the Verb-Noun format? That's because these are aliases and we'll be covering aliases in the next session.
Комментарии