2014年7月11日 星期五

PowerShell Simply induction

Windows PowerShell 是一個新的任務基礎(task-based)command-line shell scripting language,是特別為系統的管理(administration)而設計。
Windows PowerShell 是以.NET Framework為基礎來建立,, 可以幫助 IT professionals power users控制和自動化windows OS和應用程式的管理。
此外, Windows PowerShell有豐富的expression parser和完整先進的scripting language
Windows PowerShell is very different.
  • Windows PowerShell不處理text,他處理以.NET Framework platform為基礎的 objects
  • Windows PowerShell 有自己的 built-in commands,所有的shell commands使用相同的command parser和一致的介面。
Windows PowerShell 使用自己的語言,而非使用既有已經存在的語言,因為:
  • Windows PowerShell 需要管理Microsoft .NET Framework objects.的語言。
  • 這個語言需要一致的環境來使用cmdlets
  • 這個語言需要支援complex tasks,而不是使簡單的tasks更複雜。
  •  這個語言需要與如C#般在.NET Framework中使用的higher-level languages一致。


l   解釋名詞
cmdlets 就是Built-inWindows PowerShell commands,讓你可以使用command line來管理企業的電腦。
Windows PowerShell provider讓你可以存取電腦的data stores,,如registrycertificate store如同存取file system一樣的簡單。

l   使用PowerShell console
以下是在PowerShell console直接計算加法的sample。






l   使用powrshell script
以下是寫一個PowerShell script來直接計算加法的sample
1、將寫好的script存成.ps1檔案。



2、在Powershell consol執行.ps1檔案



沒有留言:

張貼留言