Options
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page
- Bookmark
- Permalink
- Email to a Friend
- Report Inappropriate Content
I have a script that converts the lun SerialNumber to hex form for comparison with lun guids in servers that are using the luns.
There is an option to select (1) only those with path matching a wildcard '*xxx* ' or (2) all luns.
The critial statements are
(1) $objlist = get-nclun | where {$_.path -like '*xxx*'} | select Path,SerialNumber,Size
(2) $objlist = get-nclun | select Path,SerialNumber,Size
When I process the list of objects, ie $objlist | % { <do some magic> }
Case (1) - the desired results. SerialNumber is there.
Case (2) - The SerialNumber attribute is missing
How can I force the return of the desired fields in both cases?
Solved! See The Solution
1 REPLY 1
- Bookmark
- Permalink
- Email to a Friend
- Report Inappropriate Content
It turns out that I was wrong. The problem is in passing the serial number to the routine that converts it to hex.
(1) $serialnumber | cvt_hex (always works)
(2) $param = "'" + $serialnumber + "'"
cvt_hex $param (fails even though protected by single quotes)
The serialnumber frequently has a + sign, and the powershell parser seems to get hung up even if protected by single quotes.