?
Solved

Need help with PowerCLI for loop

Posted on 2013-01-23
1
Medium Priority
?
484 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 2000 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

Get 15 Days FREE Full-Featured Trial

Benefit from a mission critical IT monitoring with Monitis Premium or get it FREE for your entry level monitoring needs.
-Over 200,000 users
-More than 300,000 websites monitored
-Used in 197 countries
-Recommended by 98% of users

Question has a verified solution.

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

The Nano Server Image Builder helps you create a custom Nano Server image and bootable USB media with the aid of a graphical interface. Based on the inputs you provide, it generates images for deployment and creates reusable PowerShell scripts that …
My attempt to use PowerShell and other great resources found online to simplify the deployment of Office 365 ProPlus client components to any workstation that needs it, regardless of existing Office components that may be needing attention.
Learn the basics of modules and packages in Python. Every Python file is a module, ending in the suffix: .py: Modules are a collection of functions and variables.: Packages are a collection of modules.: Module functions and variables are accessed us…
The viewer will learn how to create and use a small PHP class to apply a watermark to an image. This video shows the viewer the setup for the PHP watermark as well as important coding language. Continue to Part 2 to learn the core code used in creat…
Suggested Courses

752 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