Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ public PasswordAuthenticationMechanism Authentication
/// The default is the current user.
/// </summary>
[Parameter(Position = 1, ParameterSetName = CredentialParameterSet)]
[Credential()]
[Credential]
public PSCredential Credential { get; set; }

/// <summary>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -299,7 +299,7 @@ public string ProxyCertificateThumbprint
/// Ps Credential used by the proxy server when required by the server.
/// </summary>
[Parameter(ParameterSetName = WSManParameterSet)]
[Credential()]
[Credential]
public PSCredential ProxyCredential
{
get
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ public string[] DriveLetter
/// <summary>
/// Property that sets force parameter. This will allow to clear the recyclebin.
/// </summary>
[Parameter()]
[Parameter]
public SwitchParameter Force
{
get
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,8 +48,8 @@ public sealed class GetEventLogCommand : PSCmdlet
/// <summary>
/// Read eventlog entries from this computer.
/// </summary>
[Parameter()]
[ValidateNotNullOrEmpty()]
[Parameter]
[ValidateNotNullOrEmpty]
[Alias("Cn")]
[SuppressMessage("Microsoft.Performance", "CA1819:PropertiesShouldNotReturnArrays")]
public string[] ComputerName { get; set; } = Array.Empty<string>();
Expand Down Expand Up @@ -123,7 +123,7 @@ public string[] UserName
/// gets or sets an array of instanceIds.
/// </summary>
[Parameter(Position = 1, ParameterSetName = "LogName")]
[ValidateNotNullOrEmpty()]
[ValidateNotNullOrEmpty]
[ValidateRangeAttribute((long)0, long.MaxValue)]
[SuppressMessage("Microsoft.Performance", "CA1819:PropertiesShouldNotReturnArrays")]
public long[] InstanceId
Expand All @@ -144,7 +144,7 @@ public long[] InstanceId
/// gets or sets an array of indexes.
/// </summary>
[Parameter(ParameterSetName = "LogName")]
[ValidateNotNullOrEmpty()]
[ValidateNotNullOrEmpty]
[ValidateRangeAttribute((int)1, int.MaxValue)]
[SuppressMessage("Microsoft.Performance", "CA1819:PropertiesShouldNotReturnArrays")]
public int[] Index
Expand All @@ -165,7 +165,7 @@ public int[] Index
/// gets or sets an array of EntryTypes.
/// </summary>
[Parameter(ParameterSetName = "LogName")]
[ValidateNotNullOrEmpty()]
[ValidateNotNullOrEmpty]
[ValidateSetAttribute(new string[] { "Error", "Information", "FailureAudit", "SuccessAudit", "Warning" })]
[SuppressMessage("Microsoft.Performance", "CA1819:PropertiesShouldNotReturnArrays")]
[Alias("ET")]
Expand All @@ -186,7 +186,7 @@ public string[] EntryType
/// Get or sets an array of Source.
/// </summary>
[Parameter(ParameterSetName = "LogName")]
[ValidateNotNullOrEmpty()]
[ValidateNotNullOrEmpty]
[Alias("ABO")]
[SuppressMessage("Microsoft.Performance", "CA1819:PropertiesShouldNotReturnArrays")]
public string[] Source
Expand All @@ -207,7 +207,7 @@ public string[] Source
/// Get or Set Message string to searched in EventLog.
/// </summary>
[Parameter(ParameterSetName = "LogName")]
[ValidateNotNullOrEmpty()]
[ValidateNotNullOrEmpty]
[Alias("MSG")]
public string Message
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ public class GetWmiObjectCommand : WmiBaseCmdlet
[Alias("ClassName")]
[Parameter(Position = 0, Mandatory = true, ParameterSetName = "query")]
[Parameter(Position = 1, ParameterSetName = "list")]
[ValidateNotNullOrEmpty()]
[ValidateNotNullOrEmpty]
public string Class { get; set; }

/// <summary>
Expand All @@ -39,7 +39,7 @@ public class GetWmiObjectCommand : WmiBaseCmdlet
/// The WMI properties to retrieve.
/// </summary>
[Parameter(Position = 1, ParameterSetName = "query")]
[ValidateNotNullOrEmpty()]
[ValidateNotNullOrEmpty]
public string[] Property
{
get { return (string[])_property.Clone(); }
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -283,7 +283,7 @@ public class CoreCommandWithCredentialsBase : CoreCommandBase
/// Gets or sets the credential parameter.
/// </summary>
[Parameter(ValueFromPipelineByPropertyName = true)]
[Credential()]
[Credential]
public PSCredential Credential { get; set; }

#endregion Parameters
Expand Down Expand Up @@ -4128,7 +4128,7 @@ public class GetPSProviderCommand : CoreCommandBase
/// Gets or sets the provider that will be removed.
/// </summary>
[Parameter(Position = 0, ValueFromPipelineByPropertyName = true)]
[ValidateNotNullOrEmpty()]
[ValidateNotNullOrEmpty]
public string[] PSProvider
{
get => _provider;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ public class RegisterWmiEventCommand : ObjectEventRegistrationBase
/// The credential to use.
/// </summary>
[Parameter]
[Credential()]
[Credential]
public PSCredential Credential { get; set; }

/// <summary>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ public class StartTransactionCommand : PSCmdlet
/// The time, in minutes, before this transaction is rolled back
/// automatically.
/// </summary>
[Parameter()]
[Parameter]
[Alias("TimeoutMins")]
public int Timeout
{
Expand Down Expand Up @@ -47,7 +47,7 @@ public int Timeout
/// Gets or sets the flag to determine if this transaction can
/// be committed or rolled back independently of other transactions.
/// </summary>
[Parameter()]
[Parameter]
public SwitchParameter Independent
{
get { return _independent; }
Expand All @@ -60,7 +60,7 @@ public SwitchParameter Independent
/// <summary>
/// Gets or sets the rollback preference for this transaction.
/// </summary>
[Parameter()]
[Parameter]
public RollbackSeverity RollbackPreference
{
get { return _rollbackPreference; }
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1120,7 +1120,7 @@ public class WmiBaseCmdlet : Cmdlet
[Parameter(ParameterSetName = "WQLQuery")]
[Parameter(ParameterSetName = "query")]
[Parameter(ParameterSetName = "list")]
[Credential()]
[Credential]
public PSCredential Credential { get; set; }

/// <summary>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -147,8 +147,8 @@ public SwitchParameter PassThru
/// The name of the new NoteProperty member.
/// </summary>
[Parameter(Mandatory = true, Position = 0, ParameterSetName = NotePropertySingleMemberSet)]
[ValidateNotePropertyNameAttribute()]
[NotePropertyTransformationAttribute()]
[ValidateNotePropertyNameAttribute]
[NotePropertyTransformationAttribute]
[ValidateNotNullOrEmpty]
public string NotePropertyName
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,7 @@ public string[] MemberDefinition
/// Any using statements required by the auto-generated type.
/// </summary>
[Parameter(ParameterSetName = FromMemberParameterSetName)]
[ValidateNotNull()]
[ValidateNotNull]
[Alias("Using")]
public string[] UsingNamespace { get; set; } = Array.Empty<string>();

Expand Down Expand Up @@ -405,7 +405,7 @@ public string OutputAssembly
/// <summary>
/// Flag to pass the resulting types along.
/// </summary>
[Parameter()]
[Parameter]
public SwitchParameter PassThru { get; set; }

/// <summary>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,7 @@ public abstract class CommonRunspaceCommandBase : PSCmdlet
/// </summary>
[Parameter(Position = 0,
ParameterSetName = CommonRunspaceCommandBase.RunspaceNameParameterSet)]
[ValidateNotNullOrEmpty()]
[ValidateNotNullOrEmpty]
[SuppressMessage("Microsoft.Performance", "CA1819:PropertiesShouldNotReturnArrays")]
public string[] RunspaceName
{
Expand All @@ -134,7 +134,7 @@ public string[] RunspaceName
ValueFromPipelineByPropertyName = true,
ValueFromPipeline = true,
ParameterSetName = CommonRunspaceCommandBase.RunspaceParameterSet)]
[ValidateNotNullOrEmpty()]
[ValidateNotNullOrEmpty]
[SuppressMessage("Microsoft.Performance", "CA1819:PropertiesShouldNotReturnArrays")]
public Runspace[] Runspace
{
Expand All @@ -148,7 +148,7 @@ public Runspace[] Runspace
[Parameter(Position = 0,
Mandatory = true,
ParameterSetName = CommonRunspaceCommandBase.RunspaceIdParameterSet)]
[ValidateNotNullOrEmpty()]
[ValidateNotNullOrEmpty]
[SuppressMessage("Microsoft.Performance", "CA1819:PropertiesShouldNotReturnArrays")]
public int[] RunspaceId
{
Expand All @@ -161,7 +161,7 @@ public int[] RunspaceId
[Parameter(Position = 0,
Mandatory = true,
ParameterSetName = CommonRunspaceCommandBase.RunspaceInstanceIdParameterSet)]
[ValidateNotNullOrEmpty()]
[ValidateNotNullOrEmpty]
[SuppressMessage("Microsoft.Performance", "CA1819:PropertiesShouldNotReturnArrays")]
public System.Guid[] RunspaceInstanceId
{
Expand All @@ -173,7 +173,7 @@ public System.Guid[] RunspaceInstanceId
/// Gets or Sets the ProcessName for which runspace debugging has to be enabled or disabled.
/// </summary>
[Parameter(Position = 0, ParameterSetName = CommonRunspaceCommandBase.ProcessNameParameterSet)]
[ValidateNotNullOrEmpty()]
[ValidateNotNullOrEmpty]
public string ProcessName
{
get;
Expand All @@ -184,7 +184,7 @@ public string ProcessName
/// Gets or Sets the AppDomain Names for which runspace debugging has to be enabled or disabled.
/// </summary>
[Parameter(Position = 1, ParameterSetName = CommonRunspaceCommandBase.ProcessNameParameterSet)]
[ValidateNotNullOrEmpty()]
[ValidateNotNullOrEmpty]
[SuppressMessage("Microsoft.Performance", "CA1819:PropertiesShouldNotReturnArrays", Scope = "member",
Target = "Microsoft.PowerShell.Commands.CommonRunspaceCommandBase.#AppDomainName")]
public string[] AppDomainName
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,7 @@ public SwitchParameter PassThru
/// <summary>
/// Property that sets append parameter.
/// </summary>
[Parameter()]
[Parameter]
public SwitchParameter Append
{
get
Expand All @@ -136,7 +136,7 @@ public SwitchParameter Append
/// <summary>
/// Property that sets force parameter.
/// </summary>
[Parameter()]
[Parameter]
public SwitchParameter Force
{
get
Expand All @@ -155,7 +155,7 @@ public SwitchParameter Force
/// <summary>
/// Property that prevents file overwrite.
/// </summary>
[Parameter()]
[Parameter]
[Alias("NoOverwrite")]
public SwitchParameter NoClobber
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ public string LiteralPath
/// <summary>
/// Force writing a file.
/// </summary>
[Parameter()]
[Parameter]
public SwitchParameter Force
{
get
Expand All @@ -98,7 +98,7 @@ public SwitchParameter Force
/// <summary>
/// Do not overwrite file if exists.
/// </summary>
[Parameter()]
[Parameter]
[Alias("NoOverwrite")]
public SwitchParameter NoClobber
{
Expand All @@ -118,7 +118,7 @@ public SwitchParameter NoClobber
/// <summary>
/// Include scriptblocks for export.
/// </summary>
[Parameter()]
[Parameter]
public SwitchParameter IncludeScriptBlock
{
get
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,14 +47,14 @@ public sealed class FormatHex : PSCmdlet
/// Gets or sets the path of file(s) to process.
/// </summary>
[Parameter(Mandatory = true, Position = 0, ParameterSetName = "Path")]
[ValidateNotNullOrEmpty()]
[ValidateNotNullOrEmpty]
public string[] Path { get; set; }

/// <summary>
/// Gets or sets the literal path of file to process.
/// </summary>
[Parameter(Mandatory = true, ParameterSetName = "LiteralPath")]
[ValidateNotNullOrEmpty()]
[ValidateNotNullOrEmpty]
[Alias("PSPath", "LP")]
public string[] LiteralPath { get; set; }

Expand All @@ -68,7 +68,7 @@ public sealed class FormatHex : PSCmdlet
/// Gets or sets the type of character encoding for InputObject.
/// </summary>
[Parameter(ParameterSetName = "ByInputObject")]
[ArgumentToEncodingTransformationAttribute()]
[ArgumentToEncodingTransformationAttribute]
[ArgumentEncodingCompletionsAttribute]
[ValidateNotNullOrEmpty]
public Encoding Encoding
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ public string LiteralPath
/// Encoding optional flag.
/// </summary>
[Parameter(Position = 1)]
[ArgumentToEncodingTransformationAttribute()]
[ArgumentToEncodingTransformationAttribute]
[ArgumentEncodingCompletionsAttribute]
[ValidateNotNullOrEmpty]
public Encoding Encoding
Expand All @@ -96,7 +96,7 @@ public Encoding Encoding
/// <summary>
/// Property that sets append parameter.
/// </summary>
[Parameter()]
[Parameter]
public SwitchParameter Append
{
get { return _append; }
Expand All @@ -109,7 +109,7 @@ public SwitchParameter Append
/// <summary>
/// Property that sets force parameter.
/// </summary>
[Parameter()]
[Parameter]
public SwitchParameter Force
{
get { return _force; }
Expand All @@ -122,7 +122,7 @@ public SwitchParameter Force
/// <summary>
/// Property that prevents file overwrite.
/// </summary>
[Parameter()]
[Parameter]
[Alias("NoOverwrite")]
public SwitchParameter NoClobber
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ public class GetEventCommand : PSCmdlet
/// An identifier for this event subscription.
/// </summary>
[Parameter(Position = 0, ValueFromPipelineByPropertyName = true, ParameterSetName = "BySource")]
[ValidateNotNullOrEmpty()]
[ValidateNotNullOrEmpty]
public string SourceIdentifier
{
get
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ public class GetEventSubscriberCommand : PSCmdlet
/// An identifier for this event subscription.
/// </summary>
[Parameter(Position = 0, ValueFromPipelineByPropertyName = true, ParameterSetName = "BySource")]
[ValidateNotNullOrEmpty()]
[ValidateNotNullOrEmpty]
public string SourceIdentifier
{
get
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ public SwitchParameter Force
/// Encoding optional flag.
/// </summary>
[Parameter]
[ArgumentToEncodingTransformationAttribute()]
[ArgumentToEncodingTransformationAttribute]
[ArgumentEncodingCompletionsAttribute]
[ValidateNotNullOrEmpty]
public Encoding Encoding
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1336,7 +1336,7 @@ public string[] Exclude
/// Gets or sets the text encoding to process each file as.
/// </summary>
[Parameter]
[ArgumentToEncodingTransformationAttribute()]
[ArgumentToEncodingTransformationAttribute]
[ArgumentEncodingCompletionsAttribute]
[ValidateNotNullOrEmpty]
public Encoding Encoding
Expand Down
Loading