첫 번째 예제가 두 번째 예제와 같은 이유는 무엇입니까?원격 컴퓨터에서 Invoke-Command를 사용할 때 PowerShell에서 문자열 확장이 작동하지 않습니다.
1 :
$volumeNum = 2
Invoke-Command -ComputerName $IP -Credential $GuestVM -ScriptBlock {"select volume $volumeNum" | diskpart}
2 :
Invoke-Command -ComputerName $IP -Credential $GuestVM -ScriptBlock {"select volume 2" | diskpart}
왜 does't PowerShell을 평가
"선택 볼륨 $의 volumeNum"
-
선택 볼륨 2