Export (0) Print
Expand All
Expand Minimize
This topic has not yet been rated - Rate this topic

Converting the FileSystemObject's SerialNumber Property

Windows PowerShell

Definition: Returns the serial number used to uniquely identify a disk volume.


Well, it looks like the easiest way to do this is to simply use the FileSystemObject:

$a = New-Object -ComObject Scripting.FileSystemObject
$d = $a.GetDrive("C:\")

We start by using the New-Object cmdlet to get ahold of the FileSystemObject. Notice that we used the -ComObject parameter. We then call the GetDrive method to retrieve the drive we’re interested in. At that point all we need to do is display the SerialNumber property.

See conversions of other FileSystemObject methods and properties.
Return to the VBScript to Windows PowerShell home page

Did you find this helpful?
(1500 characters remaining)
Thank you for your feedback
© 2014 Microsoft. All rights reserved.