Ask your PowerShell-related questions, including questions on cmdlet development!
Forum rules Do not post any licensing information in this forum.
Any code longer than three lines should be added as code using the 'Select Code' dropdown menu or attached as a file.
This topic is 2 years and 2 months old and has exceeded the time allowed for comments. Please begin a new topic or use the search feature to find a similar but newer topic.
1st Question, how can I also get drive letter of the USB in my $USBs variable? I'm aware of Get-WmiObject Win32_Volume -Filter "DriveType='2'" but I can't seen to find a link to verify I'm working the right drive
Error - it appears on the last drive ( I'm testing with 4 different USBs) it doesn't complete the New-Partition so the USB gets lost, and I need to go to diskmgmt.msc to format it correctly
You will have to assign a drive letter sa teh letter acquired when it mounts will become invalid when you "clear" the USB of formatting and partitioning.
Just set the parameter to auto assign the next available drive letter when it is partitioned.
First two lines of my code detect current connected USBs on the Load event to display to my users. Currently I display just the friendlyname, but I would like to include the drive letter.
We have
But that doesn't appear to be a solution for me as I can't find the linkage to verify.
Unless I'm missing something as you can see from the image below, I have no way of linking from any of the cmds
You have to know something in advance. What is it that you know that can tell you which device is the one you want to select? Consider asking the user that inserted the device to tell you what the label on the device is then search for the label using Get-PsDrive.
When the application is opened, this code is executed in my Load function and the GUI looks like the screenshot above. Because the techs have already inserted their USB drives before launching the application that makes their USB Drives.
How would I use PSDrive within this script to also display the drive so the screen looks like the inline screen shot here
Use Get-PsDrive to match the label on the disk or disoplay all USB disks and labels with Get-PsDrive and ask the user to select the one they want to have prepared.
This topic is 2 years and 2 months old and has exceeded the time allowed for comments. Please begin a new topic or use the search feature to find a similar but newer topic.