Jump to content

Problem with detecting file system


Recommended Posts

Hi there, in a vb-Script I wanted to do a little automatic Filesystem detecting, I stumbled across the following:

When I try to run the follwoing script with an existing, but nonformated drive d:, no message is shown. Works fine, when drive d: has NTFS or FAT. Can anyone explain why?

strComputer = "."
Set objWMIService = GetObject("winmgmts:" & "{impersonationLevel=impersonate}!\\" & strComputer & "\root\cimv2")
Set colDisks = objWMIService.ExecQuery ("Select * from Win32_LogicalDisk Where DeviceID = 'D:'")

For Each objDisk in colDisks
If NOT (objDisk.Filesystem="NTFS") Then
Wscript.Echo "This is No NTFS"
End If
If (objDisk.Filesystem="NTFS") Then
Wscript.Echo "This is NTFS"
End If
Next

Thanks in advance

Edited by Doc Symbiosis
Link to comment
Share on other sites


Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...