The tricky bit that I got stuck on was when i tried Get-date I tried like this thinking it would work.
$users | Export-Csv c:\temp\LNCUS-$(Get-Date -format dd-MM-yyyy) .csv -NoTypeInformation
The error happens because the output from Get-Date is not in a string format. To fix this we just need to convert the date format to string by doing the following
$users | Export-Csv c:\temp\LNCUS-$((Get-Date).ToString('MM-dd-yyyy')).csv -NoTypeInformation
If you find this article useful please leave me a comment or click on an ad to show your support.


