Prerequisites
Steps to reproduce
As in the title, neither -Path nor -LiteralPath is marked as mandatory for Export-Csv. This prevents the cmdlet from promting for a path if we do not provide one, even though a path is required for the cmdlet to run.
PS C:\Users\xyz> (Get-Command -Name Export-Csv).ImplementingType.GetProperty('Path').GetCustomAttributes([System.Management.Automation.ParameterAttribute])
ExperimentName :
ExperimentAction : None
Position : 0
ParameterSetName : __AllParameterSets
Mandatory : False
ValueFromPipeline : False
ValueFromPipelineByPropertyName : False
ValueFromRemainingArguments : False
HelpMessage :
HelpMessageBaseName :
HelpMessageResourceId :
DontShow : False
TypeId : System.Management.Automation.ParameterAttribute
TypeId : System.Management.Automation.ValidateNotNullOrEmptyAttribute
PS C:\Users\xyz> (Get-Command -Name Export-Csv).ImplementingType.GetProperty('LiteralPath').GetCustomAttributes([System.Management.Automation.ParameterAttribute])
ExperimentName :
ExperimentAction : None
Position : -2147483648
ParameterSetName : __AllParameterSets
Mandatory : False
ValueFromPipeline : False
ValueFromPipelineByPropertyName : False
ValueFromRemainingArguments : False
HelpMessage :
HelpMessageBaseName :
HelpMessageResourceId :
DontShow : False
TypeId : System.Management.Automation.ParameterAttribute
TypeId : System.Management.Automation.ValidateNotNullOrEmptyAttribute
AliasNames : {PSPath, LP}
TypeId : System.Management.Automation.AliasAttribute
Export-Clixml for comparison
PS C:\Users\xyz> (Get-Command -Name Export-Clixml).ImplementingType.GetProperty('Path').GetCustomAttributes([System.Management.Automation.ParameterAttribute])
ExperimentName :
ExperimentAction : None
Position : 0
ParameterSetName : ByPath
Mandatory : True
ValueFromPipeline : False
ValueFromPipelineByPropertyName : False
ValueFromRemainingArguments : False
HelpMessage :
HelpMessageBaseName :
HelpMessageResourceId :
DontShow : False
TypeId : System.Management.Automation.ParameterAttribute
PS C:\Users\xyz> (Get-Command -Name Export-Clixml).ImplementingType.GetProperty('LiteralPath').GetCustomAttributes([System.Management.Automation.ParameterAttribute])
ExperimentName :
ExperimentAction : None
Position : -2147483648
ParameterSetName : ByLiteralPath
Mandatory : True
ValueFromPipeline : False
ValueFromPipelineByPropertyName : False
ValueFromRemainingArguments : False
HelpMessage :
HelpMessageBaseName :
HelpMessageResourceId :
DontShow : False
TypeId : System.Management.Automation.ParameterAttribute
AliasNames : {PSPath, LP}
TypeId : System.Management.Automation.AliasAttribute
PS C:\Users\xyz\Desktop> $results = get-process -Name pwsh*
PS C:\Users\xyz\Desktop> $results | export-clixml
cmdlet Export-Clixml at command pipeline position 1
Supply values for the following parameters:
Path: results.xml
PS C:\Users\xyz\Desktop>
Expected behavior
PS C:\Users\xyz\Desktop> $results = get-process -Name pwsh*
PS C:\Users\xyz\Desktop> $results | export-csv
cmdlet Export-Csv at command pipeline position 1
Supply values for the following parameters:
Path: results.csv
PS C:\Users\xyz\Desktop>
Actual behavior
PS C:\Users\xyz\Desktop> $results = get-process -Name pwsh*
PS C:\Users\xyz\Desktop> $results | export-csv
Export-Csv: You must specify either the -Path or -LiteralPath parameters, but not both.
PS C:\Users\xyz\Desktop>
Error details
Environment data
Name Value
---- -----
PSVersion 7.6.3
PSEdition Core
GitCommitId 7.6.3
OS Microsoft Windows 10.0.26200
Platform Win32NT
PSCompatibleVersions {1.0, 2.0, 3.0, 4.0…}
PSRemotingProtocolVersion 2.4
SerializationVersion 1.1.0.1
WSManStackVersion 3.0
Visuals
No response
Prerequisites
Steps to reproduce
As in the title, neither
-Pathnor-LiteralPathis marked as mandatory forExport-Csv. This prevents the cmdlet from promting for a path if we do not provide one, even though a path is required for the cmdlet to run.Export-Clixmlfor comparisonExpected behavior
Actual behavior
Error details
Environment data
Visuals
No response