New ManagementObjectSearcher(scope, _MountPointQuery))įoreach ( ManagementObject mp in mpsearcher.Get())Ĭonsole.WriteLine(mp.ToString()) Īrvostelijan kokemukset: Ahti GamesLoppuun tarjotaan vielä perinteiden velvoittamana ja tapojen mukaisesti arvostelijan tunnelmia ja kokemuksia käsittelyssä ja testissä olleesta casinosta. SelectQuery _MountPointQuery = new SelectQuery(_MountPointQueryString) String _MountPointQueryString = "select * FROM Win32_MountPoint WHERE Directory=\"Win32_Directory.Name=\\\"" _MountPoint "\\\"\"" _MountPoint = _MountPoint.Remove(_MountPoint.Length - 1) If (_MountPoint = Path.DirectorySeparatorChar) New ManagementObjectSearcher(scope, query))įoreach ( ManagementObject disk in searcher.Get()) SelectQuery query = new SelectQuery(queryString) String queryString = "SELECT * FROM Win32_Volume WHERE DriveLetter IS NULL" ManagementScope scope = new ManagementScope(scopeStr) String scopeStr = string.Format( "TestSqlServer") Here’s the code (it’s very watered down as I stripped out all the business logic that my client wouldn’t want me to post). The tricky part was querying Win32_MountPoint since the data that it contains is of type Win32_Directory and Win32_Volume, so you have to include a bunch of escape characters to get the syntax just right…WML is very fuzzy when it comes to that and the debugging tools are really not up to par. I could’ve just ran the query against Win32_MountPoint but I had some data in Volume that I needed. Then to get further information about the directory, i ran a query against Win32_MountPoint and got what I needed. So I used Win32_Volume and checked for the ones that don’t have a DriveLetter. Win32_LogicalDisk only gives you the drives that are mapped to a letter, so it doesn’t even see the mounted ones. So anyways, now the interesting part was getting the drive information. It keeps your users from having to know the structure of your server plus you can go beyond the alphabet in number of drives. So instead of having C:, D:, E: drives, you would have something like C:, C:\MyMountedPoints\D, C:\MyMountedPoints\E, or something maybe a little bit friendlier. Basically, a mount point is when you take a drive on your machine and instead of assigning it a drive letter, you assign it a directory within an existing drive. So after getting a quick tutorial from Google and Mikey, I was able to get going. Although I had heard of the term “mount point” before, I had never done anything with that as my sys admin skills are not anywhere close to where my programming ones are. I had to get volume and mount point information for a remote system using WMI.
0 Comments
Leave a Reply. |
Details
AuthorWrite something about yourself. No need to be fancy, just an overview. Archives
December 2022
Categories |