Reply to Message

View discussion in a popup

Replying to:
Narayanan_5245
Enthusiast
Enthusiast

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.

Reply
0 Kudos