Software Testing — Integrate PowerShell Remote Control Into Jenkins Freestyle Job

Introduction
最近需要用到Jenkins做Remote Control ,PowerShell輕便而且用途廣泛,在Windows上他是個很強力的工具,於是想到用PowerShell來進行控制。
PowerShell可以簡單地撰寫WinRM的操作 ,不過事前的設定有點繁雜 ,而且針對不同情形 ,遠端script的寫法也可以分為很多種 ,故寫下這篇做記錄。
Fundamental of writing a PowerShell scripts
在進入Remote Control前先介紹PowerShell的基本撰寫規則 ,包涵參數 ,字串格式化以及常使用的操作。
Parameters
PowerShell中以params定義參數列表 ,參數列表中可以指定參數類型 ,預設值 ,或是預設動作 ,例如在使用者未輸入該參數時丟出exception message或是跳出提示框要使用者輸入字串。








