drives

Detecting USB and Floppy Drives' Letters via VBScript

我只是一个虾纸丫 提交于 2020-02-02 15:20:26
问题 I have a Vb-script which store all removable drives' letters into a variable, As you know it contains both floppy and USB drives, I want to seperate them, I mean I want to store USB Drives' Letters in a variable and Floppy ones into another variable, Here is the script: strComputer = "." Set objWMIService = GetObject("winmgmts:" _ & "{impersonationLevel=impersonate}!\\" & strComputer & "\root\cimv2") Set colDisks = objWMIService.ExecQuery _ ("Select * from Win32_LogicalDisk") Removable = ""

Detecting USB and Floppy Drives' Letters via VBScript

余生长醉 提交于 2020-02-02 15:20:12
问题 I have a Vb-script which store all removable drives' letters into a variable, As you know it contains both floppy and USB drives, I want to seperate them, I mean I want to store USB Drives' Letters in a variable and Floppy ones into another variable, Here is the script: strComputer = "." Set objWMIService = GetObject("winmgmts:" _ & "{impersonationLevel=impersonate}!\\" & strComputer & "\root\cimv2") Set colDisks = objWMIService.ExecQuery _ ("Select * from Win32_LogicalDisk") Removable = ""

Powershell to wake up multiple media drives simultaneously

独自空忆成欢 提交于 2019-12-23 12:36:30
问题 I have a server with lots of media drives ~43TB. An areca 1882ix-16 is set to spin the drives down after 30 minutes of inactivity since most days an individual drive is not even used. This works nicely to prevent unnecessary power and heat. In this case the drives still show up in windows explorer but when you click to access them it takes about 10 seconds for the folder list to show up since it has to wait for the drive to spin up. For administrative work I have a need to spin up all the

Getting icons of Drives and Directories: Icon.ExtractAssociatedIcon(filePath) doesn't work?

痴心易碎 提交于 2019-12-21 17:18:08
问题 If Icon.ExtractAssociatedIcon(filePath) is the only way to get icons in .NET && if it doesn't work for Drives and Directories (does it?) then how do you go about getting the icons for them? In other words, I'd like to foreach (string driveName in Directory.GetLogicalDrives()) //if (System.IO.Directory.Exists(driveName)) { using (System.Drawing.Icon systemIcon = System.Drawing.Icon.ExtractAssociatedIcon(driveName)) { ... } } ^ this obviously doesn't work (works only for files) I'm not sure

DriveInfo.GetDrives() not returning mapped drives when run as administrator

爱⌒轻易说出口 提交于 2019-12-19 03:41:27
问题 I'm creating a WPF app that among other things should check for the existence of several mapped drives. The code is straightforward: DriveInfo[] systemDrives = DriveInfo.GetDrives(); foreach (DriveInfo i in systemDrives) { if ((i.Name.Contains("V")) && (i.IsReady)) { result = true; break; } } The mapped drives are mapped fro all users. The code above works fine when run as a regular user, however is Visual Studio 2010 is run as administrator the GetDrives method only returns the Fixed drives

Network Drive label

自古美人都是妖i 提交于 2019-12-12 02:34:59
问题 I'm trying to get the label of some network resources mapped as drives. When I use DriveInfo.GetDrives(), local volumes have the VolumeLabel filled parameter as expected, but in network drives it is an empty string. How can I get those labels? 回答1: You can use WMI for this - not sure of the exact query (it's been a while), but here's an example of how to get network drive free space: http://en.csharp-online.net/Network_Drive_Free_Space I think replacing 'name' with 'VolumeName' in that

Deleting Desktop Shortcuts Associated With Network Drives?

不羁岁月 提交于 2019-12-08 03:20:33
问题 I've been working to clean up a messy Active Directory as well as a network file system in the same state and I understand the concept of mapping users network drives and currently use a combination of batch and vbs files to do so. However, I need to start fresh and was wondering if there was any way to detect and delete the users shortcuts on their desktop associated with the previous network drives. (Yes - I understand how to delete all of the network drives, but: How do I detect and delete

Ruby Get Available Disk Drives

半腔热情 提交于 2019-12-07 02:44:20
问题 Can anyone tell me how I can get a list of the available disk drives in ruby? I am creating an open file dialogue and need to know! Thanks in advance, ell. 回答1: The article Brian gave correctly states the following code: require 'win32ole' file_system = WIN32OLE.new("Scripting.FileSystemObject") drives = file_system.Drives drives.each do |drive| puts "Available space: #{drive.AvailableSpace}" puts "Drive letter: #{drive.DriveLetter}" puts "Drive type: #{drive.DriveType}" puts "File system: #

Listing All Physical Drives (Windows)

坚强是说给别人听的谎言 提交于 2019-12-07 02:32:20
问题 How can I get all the physical drive paths (\\.\PhysicalDriveX) on a Windows computer, with C/C++? The answers in this question suggest getting the logical drive letter, and then getting the physical drive corresponding to that mounted drive. The problem is, I want to get all physical drives connected to the computer, including drives that are not mounted. Other answers suggest incrementing a value from 0-15 and checking if a drive exists there (\\.\PhysicalDrive0, \\.\PhysicalDrive1, ...) or

Ruby Get Available Disk Drives

扶醉桌前 提交于 2019-12-05 09:30:49
Can anyone tell me how I can get a list of the available disk drives in ruby? I am creating an open file dialogue and need to know! Thanks in advance, ell. Ell The article Brian gave correctly states the following code: require 'win32ole' file_system = WIN32OLE.new("Scripting.FileSystemObject") drives = file_system.Drives drives.each do |drive| puts "Available space: #{drive.AvailableSpace}" puts "Drive letter: #{drive.DriveLetter}" puts "Drive type: #{drive.DriveType}" puts "File system: #{drive.FileSystem}" puts "Is ready: #{drive.IsReady}" puts "Path: #{drive.Path}" puts "Root folder: #