Powershell初探
李維修 2014.11.21 在Windows Server 平台上,PowerShell是重要的指令化管理工具。以下整理工作中常用的筆記。 原始出處主要參考: 微軟官方(初階): http://technet.microsoft.com/zh-tw/library/bb978526.aspx alexc君之大作: http://ithelp.ithome.com.tw/event/ironmanarticle2/id/20005121/page/3 Hyper-V的 Powershell http://technet.microsoft.com/en-us/library/hh848559.aspx 進階的玩意兒 http://code.tutsplus.com/tutorials/say-hello-to-powershell--net-32056 PowerShell的優點 1.物件導向,每個可執行的語法( Cmdlet )的命名都是動詞-名詞,如 Get-Acl, 具結構性,好理解。 2.更容易探索Windows底層資訊(如WMI) 3.改善以往.VBS、bat檔編寫語法不一致的困擾。例如 只要了解 Sort-Object 的用法,就能將大多數 Cmdlet 的輸出排序。 4.可呼叫.net、com,也保留對以往DOS指令的支援。 如何查詢語法與線上說明 Get-help 您要查的 Cmdlet 例如 Get-help get-date 會出現 相關連結 Online version: http://go.microsoft.com/fwlink/?LinkID=113313 Set-Date New-TimeSpan 註解 若要查看範例,請輸入: "get-help Get-Date -examples". 如需詳細資訊,請輸入: "get-help Get-Date -detailed". 如需技術...