2016-07-12 3 views
1

Powershell 용 DeviceManagement 모듈을 설치했습니다. 특히 Enable-Device 및 Disable-Device 기능을 위해 설치했습니다.Powershell DeviceManagement -> Enable-Device에 대해 TargetDevice로 무엇을 전달해야하는지 어떻게 알 수 있습니까?

그러나 그 중 하나를 호출하면 TargetDevice가 필요합니다. (당연히 이해할 수 있겠지만).하지만 내 장치 (이 경우에는 드라이브)의 "이름"을 알아낼 수 없습니다. 이 명령.

답변

0

대부분의 PowerShell cmdlet과 마찬가지로 파이프 라인을 염두에두고 설계되었습니다. 이 Device Management PowerShell Cmdlets Sample – An introduction에서 직접 촬영

$deviceName = Read-Host -Prompt 'Please enter the Name of the Device to Disable' 
Get-Device | Where-Object -Property Name -Like $deviceName | Disable-Device 

$deviceName = Read-Host -Prompt 'Please enter the Name of the Device to Enable' 
Get-Device | Where-Object -Property Name -Like $deviceName | Enable-Device 

: 일반적으로

이 문제를 처리하는 가장 좋은 방법은 먼저 을 변경하는 일에 당신의 설정 또는 업데이트 cmdlet에의 목표와 파이프를 얻는 것입니다.