title: Script is dropping colon from drive letter
body: <p>I am attempting to write a script that will identify if one of multiple USB drives are connected in order to create a variable that can be used in a script so I don't have to change variables every time I copy a script to one of these flash drives.</p>
  <pre><code>$USBlibrary = @(&quot;Test1&quot;,&quot;Test2&quot;)
  $USBcurrent = (GWmi Win32_LogicalDisk | Where-Object {$_.VolumeName -in $USBlibrary} |  % {$_.DeviceID})
  
  $mydrive = $($USBcurrent[0])
  
  Write-Host &quot;$mydrive&quot;
  </code></pre>
  <p>When indexing the $USBcurrent variable, if multiple drives are connected, it outputs correctly as &quot;D:&quot; or &quot;E:&quot;, however if only one drive is connected (which would be the norm) then they system drops the colon from the variable. My understanding is that the system is attempting to read the colon as defining scope, but I have been unable to find a solution to keep this from happening.</p>