result of foreach not getting attached to the export-csv

Hello people,

I am trying to learn powercli. I use under commads to get information for VMs. looks like the results not add in the csv file. CSV file shows the result of the latest VM in import-csv file.

Q1 - can you please help identify what is bad in the commands below?

Q2 - How can I use a single export-csv command to get an output of lines both (get - vm and get-cluster)?

$vmname = import-csv "C:\vmname.csv".
{foreach ($_.name in $vmname)}
Get - vm $_.name | Select 'Name', 'Host ' | export-csv - UseCulture - NoTypeInformation C:\vmname-host-info.csv
Get-cluster - vm $_.name | Select 'name ' | export-csv - UseCulture - NoTypeInformation C:\vmcluster-info.csv}

Thank you!

You're crushed the CSV file with each iteration of the loop.

Why do you want to produce 2 CSV files? Is it not easier to keep all the info in 1 file?

Her you could do something like that

$vmname = import-csv "C:\vmname.csv".
& {{foreach ($_.name in $vmname)}}
Get - vm $_.name | Select 'Name","Host",@{N="Cluster '; E = {Get-Cluster - VM $_______ |} Select name - ExpandProperty}}

}} | Export-csv - UseCulture - NoTypeInformation C:\vm-info.csv

But the best is to use the track more PowerShell

$vmname = import-csv "C:\vmname.csv".

Get-VM-name $vmname |

Select Name,Host,@{N="Cluster; E = {Get-Cluster - VM $_______ |} Select name - ExpandProperty}} |

Export-csv - UseCulture - NoTypeInformation C:\vm-info.csv

Tags: VMware

Similar Questions

  • I get all my calls on my iphone 5.  It sounds at the end of the appellant, but it does not sound on my end and I do not get a past the call.  If the caller leaves a message, and then I get a voice message notification.

    I get all my calls on my iphone 5.  It sounds at the end of the appellant, but it does not sound on my end and I do not get a past the call.  If the caller leaves a message, and then I get a voice message notification.

    BabsMKE wrote:

    I get all my calls on my iphone 5.  It sounds at the end of the appellant, but it does not sound on my end and I do not get a past the call.  If the caller leaves a message, and then I get a voice message notification.

    settings - do not disturb - off

  • Windows Mail error message: "some of the files could not be found and could not be attached to the message." You want to send the message anyway? »

    original title: end this message appears "some of the files could not be found and he could not be attached to the message." You want to send the message anyway? "I am running Windows Vista Home Basic Edition
    Hello
    I'm so frustrated, this problem has arisen at a very bad time!

    I started to use Windows Mail a few months ago and have had no problems so far, since Thursday night, every time that I attach a file to an e-mail message when I click on send this message 'some files was not found and could not be attached to the message. You want to send the message anyway? "I am running Windows Vista Home Basic Edition.

    Thank you

    Hello

    Method 1:
    You can perform the steps of troubleshooting from the link:
    http://Windows.Microsoft.com/en-us/Windows-Vista/troubleshoot-problems-with-Windows-Mail

    Method 2:
    You can check if the default e-mail program is selected, follow the steps to do this:
    a. go to: Control Panel and go to default programs. Select Configure programs and Computer Defaults b. Select continues if the permissions window will appear
    c. left, double-click Custom, under Choose a default e-mail program, select Windows Mail.
    d. click Ok and close.

    Method 3:
    If none of the above steps are useful, then try to perform the system restore to the date when it was working fine.
    http://Windows.Microsoft.com/en-us/Windows-Vista/what-is-system-restore

    NOTE: System Restore does not affect personal files, such as e-mail, documents, or photos, so it cannot help you restore a deleted file. If you have backups of your files, you can restore files from a backup.

    Method 4:
    If the file you are trying to download is opened, then it will not download, you can close the file completely and then try to download.

     

  • I did a clean install of Mavericks and CC restored from a backup, and can not get one of the applications to load at all.

    I did a clean install of Mavericks and CC restored from a backup, and can not get one of the applications to load at all.

    properly install adobe products.

    at this point, just uninstall cc on your computer, clean by use the CC cleaning tool to resolve installation problems. CC, CS3 - CS6 then install the application of office cc, https://creative.adobe.com/products/creative-cloud

    Use the desktop application to install your programs of cc.

  • I'm not able to use the export to ftp in Muse. When I enter my host, the name and the password, I get a long interlude of the Rainbow wheel, and finally, the message that my host ftp can not be found. I checked the name and it is port 21. Can I export a H

    I'm not able to use the export to ftp in Muse. When I enter my host, the name and the password, I get a long interlude of the Rainbow wheel, and finally, the message that my host ftp can not be found. I checked the name and it is port 21. I can export to HTML and use another ftp client to download (on the same server), but it's tedious and minor changes is painful. Have you come across this and found a solution?

    Yes I have - thanks for thinking.

    Starting to think that it is a computer / connection problem. I had to move the machines to connect to the Adobe forum.   Plu MacBook thin. New macbook dead ends. These seem too coincidental independent.

    Susan

  • SubSkuCommerceItem is not get recorded in the table orders.

    We created a configurablecommerce element and adds subskucommerceitem and placed an order.

    It is, subskucommerceitem is not available in the order object in the fulfillmentpipeline formations.
    In one of the formations of fulfillmentpipeline, we did order.getCommerceItems (), which returns configurablecommerceitem. Then the getCommerceItems() on configurablecommerceitem returns null.

    On analysis further below, we noticed in the database, which could be the root cause:
    1 DCSPP_ITEM table has two lines for this order, one showing configurablecommerce point, the 2nd subsku.

    2 DCSPP_ORDER_ITEM table has an entry in this order, which is the configurablecommerce item id.

    I guess that subskucommerce is not getting stored in the descriptor control point.

    Also, there is no line in the DCSPP_CONFIG_ITEM table.

    Help, please.

    Error messages: no error message.

    Gopi

    There is code to save and load in normal subSkuCommerceItems save and load pipeline processors. The fact that you see a subsidiary question in dcspp_item means that it has been saved. Expect to see paragraphs in the table of dcspp_order_item because that's only the top-level items. Subtopics should appear in dcspp_item_ci instead.

    It is possible that your question has been registered but not recharged properly. Turn on loggingDebug in LoadCommerceItemObjects should be useful if that's the problem.

    Save this sub-item and loading code depends on the parent wrapper object CommerceItem that implements the CommerceItemContainer interface. If you have a custom CommerceItem implementation that does not implement CommerceItemContainer, which confuse the ootb save and load code. Another possibility is that code loading instantiates the class incorrect wrapper, what might happen if OrderTools is misconfigured.

  • Service request not getting associated with the Contact

    Hello

    We have an interface between the Web site of our company and Siebel On demand application, visitors can come to our Web site and submit a request by filling out a form with their contact information and their request. In turn, this creates a folder 'Contact' and a 'Request for Service' in the Application folder,

    'Contact', we used WSDL and v2.0 "Request for Service" WSDL as the webservice interface, we find that the Contacts and requests for services are created as that individual records, service demand does not get associated with the contact record is created?

    We are capture the following information under the heading "Contact".
    First name:
    First name:
    E-mail:
    Phone:
    Address:

    and the following information under the 'Service request'
    Product information:
    Object:
    Description:
    Type:
    Status:

    Should the specify us anything else under the Service request in the interface that will associate the Contact and "demand for services.

    Is it because in version 2.0, each object exist as separate nodes that we are facing this problem?
    This will be solved by using v1.0, is there a limitation any using v1.0, please specify

    You can call me if you need additional information

    Thanks and greetings
    Satish Kumar
    + 1-857-869-0239

    Hello

    When you create the Service request, make sure that you set the field "ContactId" so that the created contact is associated with the SR created.

    -John CRMIT

  • Im getting attached in the form of PDF files, that I can not open

    Im making attached in the form of PDF files, which I can not open as they come out all mixed write a cross etc I don't know how open them I have 2007 microsoft office word and excellent, thanks

    Cannot display PDF files

    You must install a PDF reader to open and view PDF files.
    Are two of the most popular to install Acrobat Reader or Foxit Reader - so you will be able to view the PDF files.

    Both are free:
    http://get.Adobe.com/reader
    http://www.foxitsoftware.com/PDF/reader

  • I finally managed to get to down load day 9.3, however can not get to check the download and install it. A window opens and says that I am not connected to the internet and its connected to my WiFi and connects via Safari whent he wants.

    Hello:

    I was finally able to download the new update 9.3 to my iPhone 5 c, but I'm not able to get it checked the update to install... A window continues to appear, saying "failed to check the update, IOS 9.3 failure of verification because you are no longer connected to the Internet" Retry or remind Me later.  It is the second day now nothing works.

    Can someone help me with thisplease,

    Thank you

    Apple released iOS 9.3 due to some problems.

    You can not install until Apple launches a new version of iOS.

  • EA6700 - could not get access to the router - hangs forever

    I hope really I can get help from som here, because this time Iom stuck.

    Just today, I have problems with my router connection.

    I use 12 IE, Firefox or Chrome. Normally, either would work.

    But now it seems that iff the router is not responding (but it is) - all web access works well - and I'm just not passed on to the GUI login.

    In Firefox, I was always able to get forwarded to the router, even if the certificate was not valid by adding an exception, but now it does not work.

    I get the following "error" messages:


  • Could not get flow for the task setting

    When sending Document and trying to view documents in Worklits you get the following error:

    < error > < oracle.soa.services.workflow.worklist > < BEA-000000 > < < oracle.bpel.services.workflow.worklist.servlet.ADFAttachmentHelper.getTaskAttachment >

    Could not get the feed for the fixing of the task:


    This seems to have been a bug in earlier versions of Oracle BPM, but we receive it on 11.1.1.7

    Any idea of what this could be the cause?

    someone experienced a similar problem but solved bu, application of a patch

    ID 1453480 - someone who has experienced a similar problem, but was solved bu patch


    Thank you

    Full restart of the committed environmental issue

  • AF:table value of text entry box does not get stored in the database.

    Hello
    I use af:table in my jsff page. The table contains the column of text entry box. After clicking the Create (+) button, a line has been added to the table. I got value into the text entry field and click the 'OK' button to commit the transaction. When I check the database, the entered value is not stored in the database. What I've observed, it's that if I have more than 1 table in the af: table and after entering the value into the text entry field, if I tab out and control moves to the next line, and then click the OK"" button. This time, the value you entered get stored in the database. It's look like, the value of current row is not updated until the action tab. Please help me solve this problem.

    JDeveloper version: 11.1.1.6

    Kind regards
    Suresh

    Hello

    What is the business service associated to this? Also the OK button have no immediate = true set

    Frank

  • Data does not get inserted into the Hxt_Add_Assign_Info_F table

    Hello

    Can tell me regarding when the data is inserted into the Hxt_Add_Assign_Info_Ftable.
    Lately this table not get updates.

    Thank you
    Bitr

    When you enter the assignment of time information, this table is filled (responsibility of the OTL Application Developer > OTL time accounting > assignment of time information)

  • Peripheral pedal VEC can not get detected on the computer

    Original title: pedal WITH USB

    Why my comp. don't find my pedal?  It was working fine, then all of a sudden, she leaves.  I need to do my job as medical transcription.

    Hello
     
    Thank you for posting the thread on Microsoft Community and we are happy to help you.
     
    The description of the problem, it seems that the computer is not able to recognize the ITH pedal device when it is connected to the computer.
     
    I wish to collect information on this problem:
    (1) what is the current operating system installed on the computer?
    (2) don't you make changes to the computer before this problem?
     
    I suggest you check the link for the type of operation that is installed on the computer
    currently:
     
     
    I suggest you to update the driver for the ITH pedal and check if it helps.
     
    Please answer us with the necessary information if the issue continues after updating the drivers for this particular device.
  • Do not get data in the target after the beginning of the session.

    Hello

    I applied the filter. source and target table are Oracle database tables. Source have data. Target of no data. I chose insert, update, commit as true in the properties of the target. Eventhough

    After the execution, I do not receive data in the tables of the target. Please check below the images.

    Thanks in advance,

    A.Kavya.

    err1.png

    192.168.0.png

    err2.png

    Hello

    Screen capture, I see you used LKM as well. Then, probably, you can start by consulting the table loading step $ CAN to see how many rows were loaded into C$ source table.

    If you have data in C$ then next step would be to check the data loaded in I$ table. I can see screenshots that you set the false Frother so that your data can not go to E$. PS please check where your data falls to C$ I $ loading.

    You can restart the interface and you can set the property 'drop of temporary objects' false so that C$ I $ table not deleted and are there for analysis.

    It will be useful.

    Thank you

    Ajay

Maybe you are looking for