iT邦幫忙

DAY 1
12

強而有力的 Windows PowerShell系列 第 1

Windows PowerShell 簡介

要使用 Windows PowerShell,當然不免俗地要先介紹 Windows PowerShell
先簡單介紹一下這次主題的主角:Windows PowerShell,是以 .NET Framework 2.0 為基礎加以擴充的命令列殼層(Shell)與腳本(Script)語言。在 2006 年所發行的是 Windows PowerShell 1.0 版,適用於 Windows XP SP2、Windows Server 2003 與 Windows Vista。隨著 Windows 7 與 Windows Server 2008 R2 的發行,Windows PowerShell 也已經發展到 2.0 版了。

由於 Windows PowerShell 與深受系統管理者愛用的 Windows Script Host(簡稱 WSH)具備往前相容的特性,所以 Windows PowerShell 不僅能使用 .NET CLR 元件(例如:使用 System.Net.Mail.SmtpClient 發送郵件),更能使用既有的 COM 技術。因此 Exchange Server 2007、System Center Operations Manager 2007、SQL Server 2008 等都內建並善用 Windows PowerShell 進行相關的管理作業。由此可見微軟對於 Windows PowerShell 這顆閃亮的明日之星的重視程度!

要開啟 Windows PowerShell 的執行環境,較簡單的作法應該是按下**「開始」按鈕,選擇「執行」選項,然後在「執行」對話方塊中的「開啟」文字方塊內,輸入 powershell,然後按下「確定」**按鈕。

cmdlet(唸法為 command-let)是在 Windows PowerShell 中,用來執行特定功能的專屬指令。這些專屬指令的格式都是用連字號(-)來連結一對動詞與名詞,而且名詞通常都是單數,其指令表示法如下:

動詞-名詞

例如,我們要查詢 Windows PowerShell 線上說明的 cmdlet 就可使用:

get-help

常見的動詞有 get、set、add、remove 等等。大家都知道 DOS 指令不區分字母的大小寫,同樣地,Windows PowerShell 的 cmdlet 也不會區分字母的大小寫!

附註:本系列的分享文章,是使用 Windows PowerShell 2.0 版。


下一篇
Windows PowerShell 基本操作 - DOS 指令馬A通
系列文
強而有力的 Windows PowerShell33
圖片
  直播研討會
圖片
{{ item.channelVendor }} {{ item.webinarstarted }} |
{{ formatDate(item.duration) }}
直播中

尚未有邦友留言

立即登入留言