官术网_书友最值得收藏!

Learning cmdlets

There are thousands of cmdlets available. Don't worry. It's not very scary. Don't think that you need to remember all those cmdlets to be a good IT admin or a developer. I do not know anybody who claims that he knows all the cmdlets. As I said earlier, the number of cmdlets are increasing day by day; what is important to know is how to get help on those cmdlets, discover the cmdlets, and learn the properties associated with specific cmdlets. Let's dive a little deeper into one cmdlet called Get-Service. Now, if you run this cmdlet in the PowerShell command prompt, you find that it returned just three columns.

Does that mean that it has just got three columns? The answer is NO. There are methods and properties associated with each cmdlet. You can learn more about those methods and properties using the Get-Member cmdlet with Get-Service.

This way you can learn about the cmdlet that you plan to use in your scripting. You can now see that there are several properties and methods that you can make use of instead of the default output. Usually, if you are a developer, you will love to know more about the methods so that you can interact with the service using code.

Let's assume that you are interested in Name, Status, and StartType. You can tweak the output now using Format-List or Format-Table cmdlet as follows:

PS C:\>Get-Service | Format-List Name, Status, StartType
PS C:\>Get-Service | Format-Table Name, Status, StartType
主站蜘蛛池模板: 潼南县| 大冶市| 页游| 镇雄县| 东至县| 牟定县| 华蓥市| 江口县| 乌恰县| 呼伦贝尔市| 万宁市| 沙河市| 航空| 金平| 介休市| 天津市| 抚顺市| 芦溪县| 湖口县| 大宁县| 射阳县| 莆田市| 海淀区| 丹巴县| 济源市| 二连浩特市| 宣武区| 宁乡县| 稷山县| 平舆县| 康乐县| 阳东县| 齐河县| 留坝县| 龙山县| 连南| 平原县| 永宁县| 平果县| 舟曲县| 孟村|