Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Get drive space does not work on specific drive
Message
 
À
03/05/2012 16:13:44
Information générale
Forum:
ASP.NET
Catégorie:
Code, syntaxe and commandes
Versions des environnements
Environment:
VB 9.0
OS:
Windows 7
Network:
Windows 2003 Server
Database:
MS SQL Server
Application:
Web
Divers
Thread ID:
01543132
Message ID:
01543155
Vues:
32
>I created another share on the same drive, such as Data2. I was able to connect to that share drive from Windows Explorer. So, the share works. However, from the code, it still cannot gain access to it. So, this confirms that the administrative share is not a factor. Either f$ or Data2 results in the same situation.

I think you are going the wrong way, I do not know .NET enough to help you, but if I do this in foxpro it would not work either:
clear
loLocator		= CREATEOBJECT('WBEMScripting.SWBEMLocator')
loWMI			= loLocator.ConnectServer()
loHDPs			= loWMI.ExecQuery('SELECT FreeSpace,QuotasDisabled,VolumeName,VolumeSerialNumber FROM Win32_LogicalDisk WHERE DeviceID="\\\\10.10.10.1\\c$"')

? DATETIME(), loHDPs.Count && Zero

FOR EACH loHD IN loHDPs
	? loHD.VolumeSerialNumber 
	? loHD.VolumeName
	? loHD.Freespace
NEXT loHD
But, if I connect to the remote machine then it will work just fine:
clear
loLocator		= CREATEOBJECT('WBEMScripting.SWBEMLocator')
loWMI			= loLocator.ConnectServer('10.10.10.1') && I am admin here too
loHDPs			= loWMI.ExecQuery('SELECT FreeSpace,QuotasDisabled,VolumeName,VolumeSerialNumber FROM Win32_LogicalDisk WHERE DeviceID="C:"') && No shares or anything, the local drive you are interested in
? DATETIME(), loHDPs.Count
FOR EACH loHD IN loHDPs
	? loHD.VolumeSerialNumber 
	? loHD.VolumeName
	? loHD.Freespace
NEXT loHD
"The five senses obstruct or deform the apprehension of reality."
Jorge L. Borges?

"Premature optimization is the root of all evil in programming."
Donald Knuth, repeating C. A. R. Hoare

"To die for a religion is easier than to live it absolutely"
Jorge L. Borges
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform