Untitled
public text v1 · immutablefunction Get-RandomFreeDrive {
$drivesinuse = get-PSDrive
$rnd = new-object "random"
$drives = ([int][char]"Z")..([int][char]"A")|?{[string[]]($drivesinuse) -notcontains [char]$_}|%{[char]$_}
return $drives[$rnd.next($drives.count)]
}