Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > ASP .Net Building Controls > get volume serial number

Reply
Thread Tools

get volume serial number

 
 
TJS
Guest
Posts: n/a
 
      12-31-2003
can anyone help me get this working for asp.net server control using vb ?

doesn't compile, error on "disk.Properties" and "response.write"

==============command line================

vbc /t:library /out:volume.dll /r:System.web.dll /r:System.dll
/r:System.Management.dll /r:System.Web.dll *.vb
pause

================code=================
Imports System
Imports System.Management
Imports System.web

Class Disk
Public Shared Sub Main()
Dim drive As String = "C"
Dim disk As ManagementObject = New ManagementObject("Win32_Logicaldisk="
+ "\"" + drive + ":\"")
Dim VolumeName As String =
disk.Properties("Volumename").Value.ToString()
Dim SerialNumber As String =
disk.Properties("Volumeserialnumber").Value.ToStri ng()
Response.write("{0} - {1}", VolumeName, SerialNumber)
End Sub
End Class


 
Reply With Quote
 
 
 
 
Ken Tucker [MVP]
Guest
Posts: n/a
 
      12-31-2003
Hi,

Dim moReturn As Management.ManagementObjectCollection

Dim moSearch As Management.ManagementObjectSearcher

Dim mo As Management.ManagementObject

moSearch = New Management.ManagementObjectSearcher("Select * from
Win32_LogicalDisk where Name = 'C:'")

moReturn = moSearch.Get

For Each mo In moReturn

Dim VolumeName As String = mo("Volumename")

Dim SerialNumber As String = mo("Volumeserialnumber")

Dim strOut As String = String.Format("{0} - {1}", VolumeName, SerialNumber)

Debug.WriteLine(strOut)

Next

Ken

-------------------

"TJS" <(E-Mail Removed)> wrote in message
news:ORM66$(E-Mail Removed)...
> can anyone help me get this working for asp.net server control using vb ?
>
> doesn't compile, error on "disk.Properties" and "response.write"
>
> ==============command line================
>
> vbc /t:library /out:volume.dll /r:System.web.dll /r:System.dll
> /r:System.Management.dll /r:System.Web.dll *.vb
> pause
>
> ================code=================
> Imports System
> Imports System.Management
> Imports System.web
>
> Class Disk
> Public Shared Sub Main()
> Dim drive As String = "C"
> Dim disk As ManagementObject = New
> ManagementObject("Win32_Logicaldisk="
> + "\"" + drive + ":\"")
> Dim VolumeName As String =
> disk.Properties("Volumename").Value.ToString()
> Dim SerialNumber As String =
> disk.Properties("Volumeserialnumber").Value.ToStri ng()
> Response.write("{0} - {1}", VolumeName, SerialNumber)
> End Sub
> End Class
>
>



 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Getting USB volume serial number from inserted device on OSX Sven Python 2 04-05-2013 01:23 PM
Re: Getting USB volume serial number from inserted device on OSX Sven Python 0 04-03-2013 08:14 AM
Re: Getting USB volume serial number from inserted device on OSX Ned Deily Python 0 04-02-2013 11:37 PM
350d serial number - what serial number?!? GT Digital Photography 6 04-07-2005 07:58 PM
Hard disk volume serial number -- help required re editing. No Cheques Cash only Computer Support 2 01-25-2004 05:11 PM



Advertisments