Quantcast
Channel: PowerShell.org » All Posts
Viewing all articles
Browse latest Browse all 13067

quick question – basic script – combine two commands

$
0
0

All, new at all the scripting things and I am missing a basic step I hope you can clue me in on. I am using VmWare Powercli, but I am 99% sure this is basic Powershell that applies to all users.

So this line :

get-cluster "Cluster" | Get-VM | select-object name, vmhost, folder

Returns me a nice little output of the data I want, like this

Name VMHost Folder
—- —— ——
P-SPAPP02 esx0315-mgmt Sharepoint
p-netops02 esx0315-mgmt NetOps
P-LyncSQL01 esx0315-mgmt Lync

And this returns some nice, pretty information as well.

get-cluster "Cluster" | Get-VM | get-networkadapter | select-object networkname

NetworkName
———–
Corporate Network
VM Production
MSCS Private Network

What is the easy, simple way to combine the two commandlets to that my final output is this:

Name VMHost Folder NetworkName
—- —— —— ———–
P-SPAPP02 esx0315-mgmt Sharepoint Corporate Network
p-netops02 esx0315-mgmt NetOps VM Production
P-LyncSQL01 esx0315-mgmt Lync MSCS Private Network

Thanks for your help….


Viewing all articles
Browse latest Browse all 13067

Trending Articles