Currently I am trying to export a list of VDI’s last logon date to a .csv but I can’t get it to work properly. This is what I currently am trying and I am a bit of a noob when it comes to scripting powershell in general.
Get-ADComputer -Filter ‘Name -like “VDI”’ -Properties * | FT Name, LastLogonDate -Autosize | select-object Name, LastLogonDate | export-csv -LiteralPath “C:\test.csv”
It won’t give me the actual list from when I run this command in a /CSV Get-ADComputer -Filter ‘Name -like “VDI”’ -Properties * | FT Name, LastLogonDate -Autosize
Can anyone help me as to what I need to do exactly to get it to automatically output to a .CSV nicely? Any help would be much appreciated.