Import-CSV Looks in Parent Directory
After throwing an error using ConvertFrom-String, Import-Csv no longer uses the current directory, but looks in the parent directory instead. I'll add my code so you may simulate the same thing. This code throws an error on ConvertFrom-String, which appears to generate the directory issue on the Import-Csv, but not other cmdlets like Get-Item or Get-Content.
$PSVersionTable:
PSRemotingProtocolVersion - 2.3
Platform - Win32NT
PSVersion - 7.0.0-rc.1
PSCompatibleVersions - {1.0, 2.0, 3.0, 4.0...}
OS -Microsoft Windows 10.0.18362
GitCommitId - 7.0.0-rc.1
WSManStackVersion - 3.0
PSEdition - Core
SerializationVersion - 1.1.0.1
Steps to Reproduce
Code:
$imp = Import-Csv .\TestColumn.csv
$Template = @'
{Type*:IP4Address},{IP:10.20.30.40}
'@
$imp.col2 | ConvertFrom-String -TemplateContent $Template -PropertyNames Type,IP
Import-Csv `.\TestColumn.csv
Content in the IP file (fake IPs... of course)
gc .\TestColumn.csv
Col1,Col2
One,@{IP4Address=10.20.30.41}
Two,@{IP4Address=10.20.30.42}
Three,@{IP4Address=10.20.30.43}
Four,@{IP4Address=10.20.30.44}
Import-CSV Looks in Parent Directory
After throwing an error using ConvertFrom-String, Import-Csv no longer uses the current directory, but looks in the parent directory instead. I'll add my code so you may simulate the same thing. This code throws an error on ConvertFrom-String, which appears to generate the directory issue on the Import-Csv, but not other cmdlets like Get-Item or Get-Content.
$PSVersionTable:
PSRemotingProtocolVersion - 2.3
Platform - Win32NT
PSVersion - 7.0.0-rc.1
PSCompatibleVersions - {1.0, 2.0, 3.0, 4.0...}
OS -Microsoft Windows 10.0.18362
GitCommitId - 7.0.0-rc.1
WSManStackVersion - 3.0
PSEdition - Core
SerializationVersion - 1.1.0.1
Steps to Reproduce
Code:
Content in the IP file (fake IPs... of course)