術語「AutomatedTest」沒有被識別爲cmdlet的名字......PowerShell函數無法識別
,但我不知道爲什麼。
但PowerShell ISE中的作品,
功能如下
if($DefaultPool.GetMachines().Name -eq $TestMachineOne)
{
MultiMachineTest
}else{
AutomatedTest
}
function AutomatedTest()
{
Write-host "test"
}
在你的調用之前移動你的函數定義。它在ISE中起作用,因爲你已經運行了你的腳本,所以上一次運行的內存中的函數。 – JohnLBevan