It works just for an half part so I can export to the *.csv file just “lastlogontimestamp” and the “name” column is showed on the screen but is not inserted in to the file… maybe I should move “Export-csv” somewhere but I didn’t understand where…
Using aliasses in scripts or in forums is considered very bad style. Please avoid them. And it would make your code much easier to read if you used line breaks after each pipe.
Format cmldets like Format-Table or Format-List are meant to be used to format console output only and should always be the last element of a pipeline. It does not make sense to pipe the output of a format cmdlet further down the pipeline.
I didn’t know how to show my code, I understood it was quite wrong to show it in that mode but I didn’t know how to do it better than it, thanks for your informations!
The script works fine, thanks to help me for this and thanks for the link to improve the code!