0

When I try to enter the following script I hope to get the memory commited in the CSV but I only get the Get-Volume part.

Here is my code:

function Get-tid {
    return "[{0:MM/dd/yy} {0:HH:mm:ss}]" -f (Get-Date)
}

Write-Output "$(Get-tid) Informationen från sökningen $dc" |
    Out-File C:\logg\logg.csv -Append

Get-Volume |
    select DriveLetter, Size, SizeRemaining,
        @{e={$_.Size - $_.SizeRemaining};l="Använt"},
        @{e={[Math]::Round(100 / ($_.Size / $_.SizeRemaining) )};l="Antal %"} |
    Add-Content -Path C:\logg\logg.csv 

Get-Counter ”\\$env:COMPUTERNAME\memory\% committed bytes in use” |
    Export-Csv -Append -Path C:\logg\logg.csv -Force
Ansgar Wiechers
  • 193,178
  • 25
  • 254
  • 328
  • 2
    `Get-Counter` returns items in the current locale language. Maybe simply run `Get-Counter` in the ISE to find the exact wording on your locale. For instance: on my Dutch machine it is called "\geheugen\percentage toegewezen bytes in gebruik" – Theo Dec 07 '18 at 09:25
  • Possible duplicate of [get-counter with locale independent IDs](https://stackoverflow.com/questions/21212871/get-counter-with-locale-independent-ids) –  Dec 07 '18 at 12:23

1 Answers1

0

Also use Out-File and not Export-CSV:

Get-Counter ”\\$env:COMPUTERNAME\memory\% committed bytes in use” | Out-file "C:\logg\logg.csv -Append -Force
Bernard Moeskops
  • 1,203
  • 1
  • 12
  • 16