Parse for a range of values

I’m hoping someone can help. I’m a new to powershell and not a programmer by any stretch , but a lowly storage administrator and we’ve been told by our bosses in their wisdom that we have to come up with an automation script in powershell each. So I thought , LUN creation. I’ve installed the hitachi cmdlets to get free lun IDs from the storage and its either XML or text , so LogicalUnitId ResourceGroupId
0 0
1 0
2 0


<?xml version="1.0" encoding="utf-16"?> 0 0

we use specific ranges for different volumes
USe L Logical Unit
ESX4 Foundation 8448 - 8703
ESX4 Gold 12288 - 12543
ESX4 Silver 16384 - 16639
ESX4 Bronze 32768 - 33023
ESX5 Foundation 8192 - 8447
ESX5 Gold 16640 - 16895
ESX5 Silver 12544 - 12799
ESX5 Bronze 33024 - 33279

So the idea is that you’ll run a script passing say esx5gold and 3 in and it’ll come up with the next 3 free LUs in that range and use to build the create-lu command ( another Hitachi cmdlet)
create-lu –StoragePool 10 -LogicalUnit xxxx -Size QQQ –serial 20756

where QQQ is the size depending on the host
ESX4 – 1.99TB
ESX5 – 4TB

but my first step is to get those logical units - any help gratefully received

Welcome to the forum.

While I’m sure that we have some very experienced PowerShellers here I’m not sure if some of them are storage administrators - at least I’m not. :wink:

Have you tried to find a solution first? Most of the time you’re not the first with a particular tasks and someone probably already solved it and shared the solution. StackOverflow or the PowerShellGallery might be a good place to start your search.

With the information you gave I’m not able to give any meaningful advice. You may explain (and show) a little more detailed what the output of the cmdlet you’ve mentioned is and what you want to do with it.

Regardless of all that: When you post code, error messages, sample data or console output please format it as code using the “preformatted text” button ( </> ).

Thanks in advance.