Csv File line count


First of all sorry for my pretty bad english :sweat_smile:
I want to display the number of line found in a specific CSV file,
I’m new with Universal Dashboard and a new PowerShell user so i try all a day and that display nothing.

That is my script :

Get-UDDashboard | Stop-UDDashboard

Start-UDDashboard -Port 10000 -Dashboard (

New-UDDashboard -Title ‘Test’ -Content{

New-UDChart -Title “Compte Utilisateur Désactivé” -Type Bar -Endpoint {
$Cache:Computers | Out-UDChartData -LabelProperty “Minute” -DataProperty “Account” -DatasetLabel “Packets per second” -BackgroundColor “#FFDAB9” -BorderColor “#FFDAB9” -HoverBackgroundColor “#FFEFD5”-HoverBorderColor “#FFEFD5
} -Height 450px -Width 1520px
) -AutoReload

New-UDEndpoint -Endpoint{
$InactiveUser = Import-Csv .\Fichier\testdisableduseraccount.csv

$Cache:Computers = ($InactiveUser | Measure-Object).Count


Can anyone tell me what i do wrong ?

Hello @papasoulman1 I understood your English just fine. So much so I have done this for you my friend:-

Which looks like
This shows how to set a cached endpoint, that will update every xxx amount of seconds/minutes so in this case it gets the files on my $env:HOMEDRIVE normally your C:\ drive, outputs the names of all my files to a CSV, that CSV will update every xxx seconds/minutes then the monitor shows the number of lines in this CSV, and I put a counter there just to look extra cool. Hope this helps my friend…?

1 Like

Wow, thank you so much.
It’s not exactly what I want but it help me :smiley:

I want to count line in a file but that I can do it alone.
I have just more question , it’s possible to have an history of the point ? I want for example the Monitor show me all the point since 7 days, i try “-DataPointHistory 7” for my 7 point but when I f5 the web page, it’s a clear monitor.

Hi @papasoulman1 glad the demo helped you. As far as I know I thought monitor charts were real-time. So for what you want you could look at a line or bar chart to display this data if you want to see the data over a period of time.

Hey @psDevUK,
When I try to modify your script when I use New-UDChart like that :

I have that :

although I use "Out-UDChartData -LabelProperty “Test” -BackgroundColor ‘#FF530D’ -BorderColor ‘black’ -HoverBackgroundColor ‘#FF9F0D’ "

I don’t understand why i search on the doc but he is not correctly update for the chart, and i use the command “help New-UDChart -full” but that doesn’t help me neither.

EDIT : So i’m trying to use multiple files with date and display it all in one monitor with the number of line, but look like a bit difficult and not clean

Any chance you can copy and paste some of the data you are trying to display from the CSV. I am then sure with that data I could create you a working chart…I understand if the data is sensitive, but if you can change it to make it un-sensitive data I can then do another demo for you.

Here the file I use in csv form and the script I use to generate this file from an AD, i make it un-sensitive and he have exactly the number of line i want, you can use it and modify the number of line for the history and you can change the script if it’s easier for you to do the dashboard with it.

Hope you understand :sweat_smile:

And a lot of thanks again :grinning:

Hello fella, so I was looking at your file you kindly uploaded. But the problem with displaying data from this is there is no figures/numbers to display. So I changed FALSE to 1 and TRUE to 2 on the ENABLED column and boom you then can display data in a graph:-

The test.csv is here

This should hopefully get you thinking on how you can display your statistics. I hope this helps?

Thanks that working great and that was a good idea i just change False by 0 and True by 1 like in binary and i had the SamAccountName in the csv files, now i just need to change my script for doing this alone.