Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Getting volume information
Message
De
16/09/2013 09:37:39
 
 
À
Tous
Information générale
Forum:
ASP.NET
Catégorie:
Code, syntaxe and commandes
Titre:
Getting volume information
Versions des environnements
Environment:
VB 9.0
OS:
Windows 7
Network:
Windows 2003 Server
Database:
MS SQL Server
Application:
Web
Divers
Thread ID:
01583334
Message ID:
01583334
Vues:
47
I usually do this to get volume information:
            ' Use WMI namespace WMI in which management options will be done
            If cUsername.Length > 0 Then
                loManagementScope = New ManagementScope("\\" + lcIP + "\root\cimv2", loConnectionOptions)
            Else
                loManagementScope = New ManagementScope("\\" + lcIP + "\root\cimv2")
            End If

            lcSQL = "SELECT * from Win32_LogicalDisk WHERE DriveType=3 AND VolumeName=""" + lcVolumeName + """"

            ' The ObjectQuery class represents a management query which returns instances or classes 
            loObjectQuery = New ObjectQuery(lcSQL)

            ' The ManagementObjectSearcher class allows the extration of an object management collection
            ' in regards to the query specified during the instantiation by the use of the
            ' ObjectQuery parameter or directly by a string
            loManagementObjectSearcher = New ManagementObjectSearcher(loManagementScope, loObjectQuery)

            ' The ManagementObjectCollection represents various object management collections extracted from WMI
            loManagementObjectCollection = loManagementObjectSearcher.Get()
But, on a domain resource, this does not work. I have for sure to pass the domain. So, I thought the username used would need to be replaced with Domain\Username. But, this gives a "The RPC server is unavailable." message.

Anyone has succeeded to use this across a domain?
Michel Fournier
Level Extreme Inc.
Designer, architect, owner of the Level Extreme Platform
Subscribe to the site at https://www.levelextreme.com/Home/DataEntry?Activator=55&NoStore=303
Subscription benefits https://www.levelextreme.com/Home/ViewPage?Activator=7&ID=52
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform