- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Getting the below error after export-csv line addition to the script. Seems the date taking based on the number of lines
PS C:\Temp> .\network-report-update.ps1
PS C:\Temp> .\network-report-update.ps1
Export-csv : Could not find a part of the path 'C:\Reports\Networklinkreport-05\29\2020.csv'.
At C:\compaq\network-report-update.ps1:98 char:5
+ } | Export-csv -Path "C:\Reports\Networklinkreport-$(Get-Date -Format ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : OpenError: (:) [Export-Csv], DirectoryNotFoundException
+ FullyQualifiedErrorId : FileOpenFailure,Microsoft.PowerShell.Commands.ExportCsvCommand
PS C:\Temp> Get-Date
Saturday, September 5, 2020 12:30:41 PM
PS C:\Temp> Get-Date -Format 'dd\/mm\/yyyy'
05/31/2020
PS C:\Temp> Get-Date -Format 'dd/mm/yyyy'
05/32/2020
Regards
Narayanan.