using intput from param $ComputerName for part of -file path in export.csv

Good morning,

I have a Script where I am using





this work fine but what I would like to do is then use the Computer Name in my export-csv -file.

For example

$outfile = "\\server\C$\Report\xxxxxx.csv

Export-csv -path $outfile

Thank you

I’m confused - if you want to use the variable you simply “reference” it where you need it …

$outfile = "\\server\C$\Report\$($ComputerName).csv
Export-csv -path $outfile

Or did I’ve got you wrong?

BTW: You have a typo in your code … there is a closing square bracket missing for your parameter $ComputerName … [String]$ComputerName.