Quantcast
Channel: PowerShell.com – PowerShell Scripts, Tips, Forums, and Resources
Viewing all articles
Browse latest Browse all 6937

exporting multiple results to txt file

$
0
0

Hay Everyone,

 

I am new to scripting and have decided to go down the path of becoming an expert in PowerShell as I believe it will be advantageous to my career, so please take it easy on me.

My question is this: I am trying to export multiple results into one text file, I have been successful in exporting the info I want into individual text files but I would much prefer to have all of the info in the one file (easier to manage). Any assistance would be greatly appreciated.

 

My Script that exports info into individual text files:

Get-ItemProperty  "C:\Program Files (x86)\Miner and Miner\ArcFM Solution\LicenseServer\Registration ID-Single use-190544.xml" | out-file "c:\scriptresults\ArcFM_Lisence_Info$((Get-Date).ToString('MM-dd-yyyy_hh-mm-ss')).txt"

Get-childItem c:\GDBReplication\ClientBase | out-file "c:\scriptresults\GIS_Data_Update$((Get-Date).ToString('MM-dd-yyyy_hh-mm-ss')).txt"

Get-childitem C:\Users | out-file "C:\scriptresults\Users_Logged_On$((Get-Date).ToString('MM-dd-yyyy_hh-mm-ss')).txt"

I have read some forums that have stated to add a pipeline at the end of the line which should work, so I modified the script to this:

Get-ItemProperty  "C:\Program Files (x86)\Miner and Miner\ArcFM Solution\LicenseServer\Registration ID-Single use-190544.xml" |

Get-childItem c:\GDBReplication\ClientBase |

Get-childitem C:\Users | out-file "C:\scriptresults\Users_Logged_On$((Get-Date).ToString('MM-dd-yyyy_hh-mm-ss')).txt"

 

But I receive the following error:

Get-childItem : The input object cannot be bound to any parameters for the command either because the

command does not take pipeline input or the input and its properties do not match any of the parameters

that take pipeline input.

At line:2 char:1

+ Get-childItem c:\GDBReplication\ClientBase |

+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

    + CategoryInfo          : InvalidArgument: (C:\Program File... use-190544.xml:PSObject) [Get-ChildI

   tem], ParameterBindingException

    + FullyQualifiedErrorId : InputObjectNotBound,Microsoft.PowerShell.Commands.GetChildItemCommand

 

Thank you in advance.


Viewing all articles
Browse latest Browse all 6937

Trending Articles