0
skip

Windows Scripting – WQL question

Recommended Posts

With so many geeks present and the success I’ve seen in past threads here I might as well give you guys a shot at this.

I am writing a script in which I need to access a removable hard drive on several different computers – however I will not be sure from machine to machine what drive letter will be assigned to the drive. What I have come up with is querying all type 3 disks on the machine and selecting the one that is not named C:

I think my logic is correct but my syntax wrong – however my logic could be wrong as well. I am completely new to scripting and in fact this is really the first WQL Query I’ve ever constructed.

Here is the code.

Set colDisks = objWMIService.ExecQuery _
Select * from Win32_LogicalDisk Where DriveType=3 AND Name != "C:"

Anyone have any experience or opinions on this?

Thanks

neil

Share this post


Link to post
Share on other sites
I don't know much about windows scripting, but in regular programming, in order to find out the kind of drive, you get the ATTRIBUTES of the drive, it will tell you if the drive is a LOCAL drive NETWORK or otherwise.
__________________________________________
Blue Skies and May the Force be with you.

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

0