Solved

Need help with PowerCLI for loop

Posted on 2013-01-23
1
480 Views
Last Modified: 2013-01-24
I am trying to get a for loop going that just gives the CanonicalName option from the output below... what do I need to do to just get that field?

foreach ($LUN in $DS) { Write-Output $LUN ; get-cluster "VDI" | Get-VMHost | Get-Datastore $LUN |
Get-ScsiLun }
alasahds002_003EX

CanonicalN ConsoleDeviceName              LunType         CapacityGB MultipathPolicy
ame
---------- -----------------              -------         ---------- ---------------
naa.600... /vmfs/devices/disks/naa.600... disk             1,072.000 Fixed
naa.600... /vmfs/devices/disks/naa.600... disk             1,072.000 Fixed
naa.600... /vmfs/devices/disks/naa.600... disk             1,072.000 Fixed
naa.600... /vmfs/devices/disks/naa.600... disk             1,072.000 Fixed

Open in new window

0
Comment
Question by:Thaidog
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
1 Comment
 
LVL 40

Accepted Solution

by:
Subsun earned 500 total points
ID: 38811638
You can select CanonicalName  at the end of the pipeline.. For example..
foreach ($LUN in $DS) { Write-Output $LUN ; get-cluster "VDI" | Get-VMHost | Get-Datastore $LUN | Get-ScsiLun | Select CanonicalName }

Open in new window

Is that what you looking for?
0

Featured Post

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Previously, on our Nano Server Deployment series, we've created a new nano server image and deployed it on a physical server in part 2. Now we will go through configuration.
Auditing domain password hashes is a commonly overlooked but critical requirement to ensuring secure passwords practices are followed. Methods exist to extract hashes directly for a live domain however this article describes a process to extract u…
The viewer will learn how to create a basic form using some HTML5 and PHP for later processing. Set up your basic HTML file. Open your form tag and set the method and action attributes.: (CODE) Set up your first few inputs one for the name and …
In a recent question (https://www.experts-exchange.com/questions/29004105/Run-AutoHotkey-script-directly-from-Notepad.html) here at Experts Exchange, a member asked how to run an AutoHotkey script (.AHK) directly from Notepad++ (aka NPP). This video…

737 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question