What is the best way to combine 2 cmdlets?

Hi, I would ask a generic basic question to solve a problem, I have constantly the.

If I have a few liners a simple like:

Get-VirtualSwitch | Select VMHost, name, @{N = "MacChanges"; E = {if ($_.)} {{ExtensionData.Spec.Policy.Security.MacChanges) {"accept"} Else {"reject"}}},

But I want to combine the results with something like

Get-VirtualPortGroup | Select Name, vlanid,

I know that members of the VirtualSwitch Get are:

Method of ConvertToVersion T ConvertToVersion [T])

Equals method Boolean Equals (System.Object, obj)

GetHashCode method int GetHashCode()

Type of the method GetType GetType()

IsConvertableTo method bool IsConvertableTo (type toType)

String the ToString ToString() method

ExtensionData, ExtensionData of System.Object {get ;} property

ID property System.String Id {get ;}

Key property System.String key {get ;}

System.Nullable'1 [[System.Int32 property of MTU, mscorlib, Version = 2.0.0.0, Culture = neutral, PublicKeyToken = b77a5c561934e089]] Mtu {get ;}

Property System.String name {get ;}

Property System.String [] {;} get Nic NIC

NumPorts System.Int32 NumPorts {;} get property

NumPortsAvailable System.Int32 NumPortsAvailable {;} get property

UID property System.String Uid {get ;}

VMHost property VMware.VimAutomation.ViCore.Types.V1.Inventory.VMHost VMHost {get ;}

VMHostId property System.String VMHostId {get ;}

VMHostUid property System.String VMHostUid {get;


and Get-VirtualPortGroup members:

Method of ConvertToVersion T ConvertToVersion [T])

Equals method Boolean Equals (System.Object, obj)

GetHashCode method int GetHashCode()

Type of the method GetType GetType()

IsConvertableTo method bool IsConvertableTo (type toType)

String the ToString ToString() method

ExtensionData, ExtensionData of System.Object {get ;} property

Key property System.String key {get ;}

Property System.String name {get ;}

Port VMware.VimAutomation.ViCore.Types.V1.Host.Networking.PortGroupPort of property [] Port {get ;}

UID property System.String Uid {get ;}

VirtualSwitch property VMware.VimAutomation.ViCore.Types.V1.Host.Networking.VirtualSwitchBase VirtualSwitch {get ;}

VirtualSwitchId property System.String VirtualSwitchId {get ;}

VirtualSwitchName property System.String VirtualSwitchName {get ;}

VirtualSwitchUid property System.String VirtualSwitchUid {get ;}

VLanId property System.Int32 VLanId {get ;}

VMHostId property System.String VMHostId {get ;}

VMHostUid property System.String VMHostUid {get ;}

I don't know if I should simply declare what I want to get back, or write a foreach statement.

Hello, JohnMcKeown-

I'm not quite sure what you mean by "declare what I want back.

With regard to the foreach loop [-object], Yes, it's probably a nice way to go.  Something like:

Get-VirtualSwitch | %{$oThisSwitch = $_; Get-VirtualPortGroup -VirtualSwitch $oThisSwitch |    select @{n="VMHost"; e={$oThisSwitch.VMHost}},        @{n="vSwitchName"; e={$oThisSwitch.Name}},        @{n="MacChanges"; e={if ($oThisSwitch.ExtensionData.Spec.Policy.Security.MacChanges) {"Accept"} else {"Reject"} }},        Name, vlanid} ## end foreach-object

However, this is not quite a good word that you just go to go out when you want the info quickly.  Probably something suitable to based on its periodic use.

Tags: VMware

Similar Questions

  • What is the best way to make a PDF file several Photoshop images, while maintaining editable layers?

    What is the best way to make a PDF file several Photoshop images, while retaining the layers in editable for later use mode? I tried to do in Acrobat, but it does not keep separate layers. I also tried to automate the PDF presentation in Photoshop, but it combines the layers as well. I need to enable layers from photoshop retain their ability to be edited.

    It is not possible at this time, Photoshop is not a page layout program and pdf is hardly a format suitable to hold several files psd layered or editable page layouts.

    Why would you do that anyway?

  • What is the best way to view an interactive report with 20 columns

    Hello

    I have an interactive report, given the number of columns (about 20).
    What is the best way to view this report... by default to scroll horizontally to see all the columns.
    I want to avoid horizontal scrolling.

    Thank you
    Deepak

    Hello Deepak,

    You mean apart using a smaller font size or a larger screen?
    You can think to combine / wrapping columns (so more data in a column).
    Or hide some less important data and show only on request.

    Greetings,
    Roel
    http://roelhartman.blogspot.com/
    You can reward this response in marking it as useful or Correct ;-)

  • What is the best way to buy an iPhone Unlocked 7?

    Hi all

    I am currently using T-Mobile and want to get the new iPhone 7. Since there is no option for a sim-free iPhone, what is the best way to buy the new iPhone? Should I get the T-Mobile one full fare? I know that he will be released version but it will come with a T-Mobile sim so what will do with the sim card? Put it away or give it to T-Mobile? Or should I wait for the version without card sim to appear, which I don't think that will come out until November, and I don't want to wait that long.

    Thank you in advance.

    If you do not want to wait to pay full price for the model from T-Mobile.  You can do whatever you want with the SIM card.

  • I'll do a clean install on a blank hard drive upgrade but want to keep my Firefox settings - what is the best way to do this?

    I'll do an upgrade from Windows XP to Windows 7. I will be installing Windows 7 on a new empty hard drive. I want to keep my bookmarks Firefox and Ad Ons. What is the best way to do it. Thank you for your help.

    Hello

    The best thing for you to do is to make a backup of your Firefox profile. It is a folder that stores bookmarks and Add-ons that you can then add to the reinstalled Firefox on your new operating system.

    Learn you more about the Firefox profile folder, how to backup and restore, here.

    I hope this helps, but if not, please come back here and we can look at in another option for you.

  • What is the best way to consolidate e-mail messages in the e-mail program, before deleting?

    I have an iMac with a capacity to 1.11 - 679,49 GB available. With the software updated.

    Model name: I

    I have emails out of my different accounts in a "random" folder, but is not free up space. If I move an email in "Archives" and then it always remains in the e-mail account, apparently duplicate email in two places. "

    ERGO: the question is...

    What is the best way to consolidate e-mail messages in the e-mail program, before deleting?

    (I hope I've inserted which may be useful, but I'm not sure about that.)

    Thank you

    ilenefrombaltimore

    Archive messages or move them to some other local mailboxes or mailboxes on the server. Don't know what you are trying to do because it appears that you have 2/3 of your hard disk.

    Why do you think archiving emails in 2 places? Where are you trying to save space to?

  • What is the best way to sync contacts with a host of webdav?

    I use Thunderbird and Contacts Android as of client applications with an owncloud 8 hosted remotely. I have activated the application Contacts on Owncloud and now I want to sync the contacts between these systems. What is the best way to do it?

    I try to get sorted first Thunderbird. I tried Addressbooks Synchronizer, but currently, it gives me a message telling me that my credentials are wrong or is sitting silently, do nothing. I am aware that it is a file synchronization, the method of synchronization not saved, so it is not ideal, in any case.

    Is there a better, good timing, method I can use? I refuse to the thing that he is an unreasonable request or that no one asked before me, but I can't seem to find the answer.

    Thanks, Martin

    WebDAV my initial reaction was sogo connector.
    These guys recommend the same http://kb.mozillazine.org/Sharing_address_books

    Here http://www.sogo.nu/english/downloads/frontends.html

  • What is the best way to copy the 700 lots of e-mail files to a new computer?

    I'm moving my wife and an old (Thunderbird, Win XP) computer to a new computer (Thunderbird Win 7). It has about 700 local folders with thousands of emails in them. What is the best way to copy to the new computer?

    The easiest is just to copy the whole profile.

    Menu help > troubleshooting information

    Close Thunderbird

    In windows Explorer, select all and copy.
    just stick on a thumb or other portable media to read/write (not the CD or the DVD)

    on the new Machine to repeat the troubleshooting and close the steps to get the current profile folder

    This time all the portable media stick in the profile to replace what is there

    Open Thunderbird, your additions of e-mail contacts does it all

  • What is the best way to retrieve deleted mp3 files? I am running OSX Leopard 10.5.8 on a PowerPC G5 tower. I'll be very grateful for any help in this matter. Thanks to Chris

    Hello

    What is the best way to retrieve deleted mp3 files? I had a lapse of attention and I deleted a folder containing most of my music files. It is for the most part, the mp3 but there was regular audio files and some wav files in there also. I am running OSX Leopard 10.5.8 on a PowerPC G5 tower. I have another PPC machine to help the recovery, if I need, but at the moment, he is not appearing on my network (3 computers). I'm trying to change this soon. I'll be really grateful for any help in this matter.

    Thanks to Chris

    If you emptied the Recycle Bin after you move the folder to the trash, and you don't have a time Machine or another backup, then it is lost, sorry.

  • What is the best way to manage applications so that they do not fill a space of memory?

    I have an iPad Air Os9, 64 g

    However, I am already up to 39 g mem.

    What is the best way to manage applications if tat I can use them, but no pork then my mem space?

    y at - it an app that manages the apps?  should I delete and re-download a few apps later?

    I would like to take advantage of many more applications that I believe I have space for.

    You can see how much storage resumes via the settings app > general > Manage Storage - this screen lists each app space (the application and its content), total by selecting an app on this screen should tell you how much space the application content (files, documents, etc.) resumes.

    y at - it an app that manages the apps?

    No, iOS is a sandbox environment, apps can control or manage other applications.

    should I delete and re-download a few apps later?

    Depends on the app. deletion of an app will also delete its content, if it is an application where its content is important (such as documents), and that content is not stored elsewhere (e.g.)  Dropbox or cloud server), you may lose this content by deleting the app.

  • What is the best way (and possible) to remix a song mixed

    GarageBand 10.1.1

    10.11.4 OS

    Mac Book Pro

    16G RAM

    Hobby old YR 68 recording guy/try to leave a legacy

    What is the best way (and possible) to remix a song mixed

    I have a song that is most often improvised, I was told that his cool, however, re-registration is not possible.

    After reading a lot on the mixture, I now hear where the uneducated choice and errors that I made which explains the sound "not as good" that the song is.

    Before I just jump in and try to undo the settings on the tracks (one is DRUMMER) to return to the raw track before effects/eq/compression ect. is is possible to do?  Opens the unfavorable mix, rename it, save it and just go to work and cancel or disable 'things '.

    The basis of the lean mixture comes even to the root where I 'hot' securities, (orange and red)

    I guess by now you understand my question and I am open to a favorable opinion.

    Thanks in advance for your help.

    jojoguiitar_mn_usa

    I read this question so many times and I can't seem to figure out exactly what you're asking.  You just ask if you can go back in your GarageBand project and edit your tracks again?  Of course, you can, why not you?

  • What is the best way to place an alias of the Recycle Bin on my desktop?

    Application of small trivial customization here.  Using OS X 10.11.4, what is the best way to create a trash can on the desktop?  I already tried the Terminal command to place the alias, but I'm unable to change the icon.  Given that I have with this method, how to change the folder icon image so that it represents a trash can?  I would find it useful enough to be honest.

    Thanks in advance.

    You can try to drag /System/Library/CoreServices/CoreTypes/Contents/Resources/TrashIcon.icns into the window read the information for the Alias. Upper left corner.

  • What is the best way to move from an Intel iMac a iMac 4K

    I have an iMac 21 "4 k new in a few days and I wonder what the best what's the best way to migrate my old iMac to the new?

    Configuration wizard migration wizard or any transfer via time machine, then for the new iMac?

    Migration wizard is the recommended method. Here is a link to Apple description of it.

  • What is the best way of reformatting my MacBook ssd for resale?

    I'm preparing my 2015 12 '' MacBook 1.3 GHz 512 for resale.  What is the best way to erase and reformat the SSD drive?

    Thanks in advance!

    -jag

    Before you sell or give away your computer, and more the steps listed in this article to support, please follow these steps:

    1. run the Diagnostics from Apple or the Apple Hardware Test. The buyer will do (or it should), and you won't be surprised by the results.

    2. reset the PRAM and the SMC, which may contain personal information.

    3. If you set a firmware password, remove it by running the utility in recovery mode firmware password.

    4. If you turn on FileVault in OS X 10.7 or later, turn it off.

    5. If you use Boot Camp, the partition must be deleted.

    6. If you have created another partition of data on internal disk, remove them in disk utility.

    7. If the machine has an internal hard drive, erase the remaining data partition with the possibility of putting the data to zero. An SSD has no need to be set to zero.

    8. remove the machine from your list of registered products. If it is still covered by an AppleCare Protection Plan, transfer the warranty to the new owner as described in the terms and Conditions AppleCare (under the heading "Transfer of Plan.")

    Note also:

    You can legally or transfer almost any software downloaded from the Mac App Store to the new owner of the machine, even if it was free. This includes OS X, so if you've switched to OS X 10.7 or later, you need to reinstall an operating system older, either from the installation media, if any, or by commissioning in recovery mode of the Internet (option-command-R start ringing.)

    The new owner will have to re-download everything software that came on the App Store, as appropriate, including updates of OS X, under her Apple ID. If you never updated applications bundled iLife (iPhoto, iMovie and Garage Band) through the App Store, you can not transfer these either. The buyer must buy them. Note that iPhoto has been suspended and is no longer available for purchase.

  • What is the best way to backup a hard drive full of pictures and videos on another external hard drive?

    What is the best way to backup a hard drive full of pictures and videos on another external hard drive? I want an exact clone-

    Drag and Drop? Time Machine?

    Thank you. DB

    < object edited by host >

    If you want an exact clone, you will need to use a utility like utility disk, Carbon Copy Cloner or SuperDuper!

Maybe you are looking for