Author Posts

November 6, 2013 at 2:02 am

Hello Guys
I have a question..
I want to export several properties into a csv-file.
I tried it with export-csv and output-file and it even generated me a file, but it was blank.
So what could i do so that it generate a file which isn't blank.

November 6, 2013 at 4:29 am

In order for there to be data in the file, you have to pipe something to it. In your other thread, you had a pipeline that was producing zero objects by the time it got to Export-Csv, which will always result in a blank file.

November 6, 2013 at 5:25 am

i made foreach-object loop and filtered out the properties which value was over 50000.
Now the script look like this:
Param (
[string]$Path = "N:\",
[string]$ReportPath = "N:\Test\report.csv",

Function AddObject {
Param (

$Size = [double]($FSO.GetFolder($FileObject.FullName).Size)
$Script:TotSize += $Size

# Got rid of the code that converted $Size from a double to a String here

$Script:Report += New-Object PSObject -Property @{
FolderName = $FileObject.FullName
CreatedOn = $FileObject.CreationTime
LastUpdated = $FileObject.LastWriteTime
Size = $Size
Owner = (Get-Acl $FileObject.FullName).Owner

Function CalculateSize {
Param (
If ($Size -gt 1000000)
{ $ReturnSize = ($Size / 1GB)
{ $ReturnSize = ($Size / 1MB)
Return $ReturnSize

Function Set-AlternatingRows {


Begin {
$ClassName = $CSSEvenClass
Process {
ForEach ($Line in $Lines)
{ $Line = $Line.Replace("

November 6, 2013 at 5:31 am

I don't see any call to Export-Csv or Out-File in your code. Also, you're using Write-Host inside that foreach-object loop. Write-Host outputs to the console, but does not produce any pipeline output. I'm not sure what you're trying to accomplish with that bit of code.

If you just want to filter out based on size, it's better to use Where-Object:

$Report |
Where-Object { $_.Size -gt 500000 } |

November 6, 2013 at 6:06 am

Thanks Dave Wyatt
because of the Export-csv i removed it from the code, because it haven't done anything

November 6, 2013 at 7:21 am

Assuming that there are no folders found with sizes greater than your limit, what do you want to be in the files? As I've said, if you pipe nothing to Export-Csv, nothing is what you get. It's possible to work around that, but I don't know what your requirements are at this point.