首頁>Club>
7
回覆列表
  • 1 # 軟體先生

    學習PowerShell最好的文件就是Powershell自帶的幫助文件,下面幾個命令非常的重要,學會了這些命令已經經常使用這些命令,就相當於學會了捕魚,而不是有什麼問題上百度一搜,讓百度給你送魚,這個很重要。

    Get-Help

    Get-Command

    Get-Member

    Get-Module

    Get-Alias

    下面是這些命令的一些例子,

    Get-Help –verb

    Get-Help Get-Member –examples

    Get-Help

    Get-Command | more

    Get-Command | sort-object noun | format-table -group noun

    Get-Alias | more

    Get-Help stop-service -detailed | more

    另外,對於操作PowerShell返回來的物件的一些通用的動詞字首也很重要,比如:

    Compare-Object : Compare 2 sets of objects

    Foreach-Object : Act on each element of a set

    Group-Object : Split a set of objects into groups

    Measure-Object :Measure some property of a set of objects

    Select-Object :Select a set of properties from a set of objects

    Sort-Object : Sort objects

    Tee-Object : Make a copy of a set of objects

    Where-Object :Select a subset of objects

    下面是一個例子,比較前後兩個物件有什麼不同

    $before_process=Get-Process

    notepad

    $after_process=Get-Process

    Compare-Object $before_process $after_process

    最後,如果你在進一步深入學習,下面是一些參考資料

    Team blog: http://blogs.msdn.com/PowerShell

    PowerShell Community: http://www.powershellcommunity.org

    PowerShell Forum: http://social.technet.microsoft.com/Forums/en-US/winserverpowershell/threads

    Channel 9: http://channel9.msdn.com/tags/PowerShell

    Wiki: http://channel9.msdn.com/wiki/default.aspx/Channel9.WindowsPowerShellWiki

    Script Center: http://www.microsoft.com/technet/scriptcenter/hubs/msh.mspx

    CodePlex: http://codeplex.com/Project/ProjectDirectory.aspx?TagName=powershell

    PowerShell in Action, 2nd Edition by Bruce Payette

    http://www.manning.com/payette2

    Windows PowerShell Cookbook, 2nd Edition by Lee Holmes http://oreilly.com/catalog/9780596801519/

    PowerShell Comics! http://borntolearn.mslearn.net/comics/b/weblog/archive/2011/04/20/climbing-mt-powershell-comic-book-first-pages.aspx

  • 中秋節和大豐收的關聯?
  • 只有和顏值高的人結婚才能生下顏值高的後代嗎?