Was this page helpful?
Your feedback about this content is important. Let us know what you think.
Additional feedback?
1500 characters remaining
Export (0) Print
Expand All
Collapse the table of content
Expand the table of content
Expand Minimize

Converting VBScript's LBound Function

Windows PowerShell

Definition: Returns the smallest available subscript for the indicated dimension of an array.


Typically the lower bound of an array (that is, the index number assigned to the first element in the array) is 0. In Windows PowerShell you can verify that by using the GetLowerBound() method. For example, suppose we use the following command to create an array named $a:

$a = 1,2,3,4,5,6,7,8,9

We can then use this command to determine the lower bound of the array and store that value in the variable $b:

$b = $a.getlowerbound(0)

Note. The parameter 0 passed to GetLowerBound() simply means that we want to look at the first dimension in the array. If we were working with a multi-dimensional array we could supply other values to GetLowerBound().

When you run this command and then echo back the value of $b you should get the following:


Return to the VBScript to Windows PowerShell home page

Was this page helpful?
(1500 characters remaining)
Thank you for your feedback
© 2015 Microsoft