CmdID / PowerShell / Cmdlets / Disable
Disable-LocalUser
Disables a local user account. PowerShell reference
From the PowerShell reference
5 parameters
Alias dlu
What it does
Disables a local user account. The Disable-LocalUser cmdlet disables local user accounts. When a user account is disabled, the user cannot log on. When a user account is enabled, the user can log on. NOTE: The Microsoft.PowerShell.LocalAccounts module is not available in 32-bit PowerShell on a 64-bit system.
Disable-LocalUser [-InputObject] <LocalUser[]> [-WhatIf] [-Confirm] [<CommonParameters>]Disable-LocalUser [-Name] <String[]> [-WhatIf] [-Confirm] [<CommonParameters>]Disable-LocalUser [-SID] <SecurityIdentifier[]> [-WhatIf] [-Confirm] [<CommonParameters>]
Disable an account by specifying a name
Disable-LocalUser -Name "Admin02"IdentifyDisable an account by using the pipeline
Get-LocalUser Guest | Disable-LocalUserIdentifyIts page in the reference: Disable-LocalUser.
Parameters
-InputObjectSpecifies an array of user accounts that this cmdlet disables. To obtain a user account, use the
Get-LocalUser cmdlet.-NameSpecifies an array of names of the user accounts that this cmdlet disables.-SIDSpecifies an array of user accounts that this cmdlet disables.-ConfirmPrompts you for confirmation before running the cmdlet.-WhatIfShows what would happen if the cmdlet runs. The cmdlet is not run.