Skip to content

[AllowEmptyString()] for -Description in Set-LocalGroup/Set-LocalUser #16049

Description

@iRon7

Prerequisites

Steps to reproduce

See: StackOverflow question: How to set the description of a local group to blank

The Set-LocalGroup/SetLocalUser cmdlet do not allow empty strings for the -Description parameter (which is set to [ValidateNotNull()]):

New-LocalGroup -Name 'Group1' -Description 'My description'

Name   Description
----   -----------
Group1 My description

Set-LocalGroup -Name 'Group1' -Description ''

Expected behavior

Description set to a zero length string:

Get-LocalGroup -Name 'Group1'

Name   Description
----   -----------
Group1

Actual behavior

Set-LocalGroup: Cannot bind argument to parameter 'Description' because it is an empty string.

Consequently it is not possible to clear the description with the concerned cmdlets.

Environment data

Name                           Value
----                           -----
PSVersion                      7.1.4
PSEdition                      Core
GitCommitId                    7.1.4
OS                             Microsoft Windows 10.0.19042
Platform                       Win32NT
PSCompatibleVersions           {1.0, 2.0, 3.0, 4.0…}
PSRemotingProtocolVersion      2.3
SerializationVersion           1.1.0.1
WSManStackVersion              3.0

Metadata

Metadata

Assignees

No one assigned

    Labels

    Needs-TriageThe issue is new and needs to be triaged by a work group.Resolution-ExternalThe issue is caused by external component(s).

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions