locked
Script issue with append RRS feed

  • Question

  • I have a script i use to rename folders after they are moved. it creates the csv but no data makes it into the csv and is left blank. The rename process works and no errors are returned

    rename-item jdoe "doe, jane" | export-csv M:\HomesArchive2018\fs1.csv -append
    rename-item mdoe "doe,mary" | export-csv M:\HomesArchive2018\fs1.csv -append


    Stonecold31666

    Tuesday, January 30, 2018 1:07 PM

Answers

  • Rename-Item cmdlet outputs nothing by default to the pipeline for Export-CSV to coniume.

    Use -PassThru switch parameter of Rename-Item cmdlet to have the output given to the pipeline for Export-CSV to consume. You can go though below Help docs.

    Get-Help Rename-Item -Parameter PassThru

    for your problem...

    Rename-Item jdoe "doe, jane" -PassThru | Export-CSV M:\HomesArchive2018\fs1.csv -Append


    Regards kvprasoon


    • Edited by PRASOON KARUNAN V Tuesday, January 30, 2018 6:24 PM
    • Proposed as answer by jrv Tuesday, January 30, 2018 7:26 PM
    • Marked as answer by stonecold31666 Friday, February 2, 2018 3:29 PM
    Tuesday, January 30, 2018 6:23 PM

All replies

  • Rename-Item cmdlet outputs nothing by default to the pipeline for Export-CSV to coniume.

    Use -PassThru switch parameter of Rename-Item cmdlet to have the output given to the pipeline for Export-CSV to consume. You can go though below Help docs.

    Get-Help Rename-Item -Parameter PassThru

    for your problem...

    Rename-Item jdoe "doe, jane" -PassThru | Export-CSV M:\HomesArchive2018\fs1.csv -Append


    Regards kvprasoon


    • Edited by PRASOON KARUNAN V Tuesday, January 30, 2018 6:24 PM
    • Proposed as answer by jrv Tuesday, January 30, 2018 7:26 PM
    • Marked as answer by stonecold31666 Friday, February 2, 2018 3:29 PM
    Tuesday, January 30, 2018 6:23 PM
  • Hi,
    Just checking in to see if the information provided was helpful. Please let us know if you would like further assistance.

    Best Regards,

    Frank

    Please remember to mark the replies as an answers if they help.
    If you have feedback for TechNet Subscriber Support, contact tnmff@microsoft.com

    Wednesday, January 31, 2018 8:12 AM