Prerequisites
Steps to reproduce
The code below outputs syntax help and the mandatory property of the attribute for Write-Progress and its -Activity parameter. It also invokes Write-Progress -Completed without -Activity. The help syntax has no [] around [-Activity] <System.String>. I understand this to mean the value for the parameter is mandatory (the parameter name, on the other hand, is optional). The mandatory property is false. I gather that since #18474 -Activity is meant to be optional. However, the help syntax seems to indicate the parameter is mandatory, though. This leads me to the following questions:
- Is the help syntax incorrect?
- If it is the help syntax that is incorrect, how is that help generated?
repro.ps1
Get-Help Write-Progress | % syntax
Get-Command Write-Progress | % {$_.Parameters['Activity']} | % Attributes | Select-Object Mandatory
Write-Progress -Completed
Expected behavior
PS>.\repro.ps1
Write-Progress [[-Activity] <System.String>] ...
Mandatory : False
Actual behavior
PS>.\repro.ps1
Write-Progress [-Activity] <System.String> ...
Mandatory : False
Error details
No response
Environment data
Name Value
---- -----
PSVersion 7.4.6
PSEdition Core
GitCommitId 7.4.6
OS Microsoft Windows 10.0.22631
Platform Win32NT
PSCompatibleVersions {1.0, 2.0, 3.0, 4.0…}
PSRemotingProtocolVersion 2.3
SerializationVersion 1.1.0.1
WSManStackVersion 3.0
Visuals
No response
Prerequisites
Steps to reproduce
The code below outputs syntax help and the mandatory property of the attribute for
Write-Progressand its-Activityparameter. It also invokesWrite-Progress -Completedwithout-Activity. The help syntax has no[]around[-Activity] <System.String>. I understand this to mean the value for the parameter is mandatory (the parameter name, on the other hand, is optional). The mandatory property is false. I gather that since #18474-Activityis meant to be optional. However, the help syntax seems to indicate the parameter is mandatory, though. This leads me to the following questions:repro.ps1
Expected behavior
Actual behavior
Error details
No response
Environment data
Visuals
No response