Quantcast
Channel: Windows PowerShell forum
Viewing all articles
Browse latest Browse all 21975

Powershell confirm Drive

$
0
0

Hello,

I am writing a powershell script to copy files.  I do not want these files copied to a local disk or network share. They must be copied to a USB drive. We actually currently have people mistyping the Drive letter and then mucking up other network drives with copied data.

So i do this in powershell:


$DRIVE = Read-Host 'Please Enter USB Drive Letter:'

I want to type the drive letter they gave, lets say E and confirm that E is a USB storage device. Another Device type should error out and ask them for the drive letter again before moving on. 

How can i do this?


Viewing all articles
Browse latest Browse all 21975

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>