Skip to content

Latest commit

 

History

History
285 lines (227 loc) · 5.78 KB

File metadata and controls

285 lines (227 loc) · 5.78 KB
document type external help file HelpUri Locale Module Name ms.date PlatyPS schema version title
cmdlet
linuxtools-Help.xml
en-US
linuxtools
11/09/2025
2024-05-01
New-LocalUser

New-LocalUser

SYNOPSIS

Create a new local user account

SYNTAX

__AllParameterSets

New-LocalUser [-Name] <string> [[-UID] <int>] [-Comment] <string> [[-Password] <securestring>]
 [[-HomeDirectory] <string>] [[-ShellPath] <string>] [[-GroupID] <int>] [[-AccountExpires] <string>]
 [-NoHomeDirectory] [<CommonParameters>]

ALIASES

This cmdlet has the following aliases, {{Insert list of aliases}}

DESCRIPTION

Create a new local user account

EXAMPLES

EXAMPLE 1

New-LocalUser -Name "Fu Barr" Comment "The Fubar of Tarfu" Creates a new user account named "Fu Barr" with the comment "The Fubar of Tarfu"

EXAMPLE 2

New-LocalUser -Name "Fu Barr" Comment "The Fubar of Tarfu" -AccountExpires "5/1/2025" Creates a new user account named "Fu Barr" with the comment "The Fubar of Tarfu" and expires on May 1, 2025

EXAMPLE 3

New-LocalUser -Name "Fu Barr" Comment "The Fubar of Tarfu" -Password (ConvertTo-SecureString -String "P@ssw0rd" -AsPlainText -Force) Creates a new user account named "Fu Barr" with the comment "The Fubar of Tarfu" and sets the password to "P@ssw0rd"

EXAMPLE 4

New-LocalUser -Name "Fu Barr" Comment "The Fubar of Tarfu" -HomeDirectory "/home/fubar" -ShellPath "/bin/zsh" Creates a new user account named "Fu Barr" with the comment "The Fubar of Tarfu", home directory "/home/fubar", and shell path "/bin/zsh"

EXAMPLE 5

New-LocalUser -Name "Fu Barr" Comment "The Fubar of Tarfu" -NoHomeDirectory Creates a new user account named "Fu Barr" with the comment "The Fubar of Tarfu" and does not create a home directory

PARAMETERS

-AccountExpires

Optional. Date when the account expires

Type: System.String
DefaultValue: ''
SupportsWildcards: false
Aliases: []
ParameterSets:
- Name: (All)
  Position: 7
  IsRequired: false
  ValueFromPipeline: false
  ValueFromPipelineByPropertyName: false
  ValueFromRemainingArguments: false
DontShow: false
AcceptedValues: []
HelpMessage: ''

-Comment

Comment to assign to the new user account

Type: System.String
DefaultValue: ''
SupportsWildcards: false
Aliases: []
ParameterSets:
- Name: (All)
  Position: 2
  IsRequired: true
  ValueFromPipeline: false
  ValueFromPipelineByPropertyName: false
  ValueFromRemainingArguments: false
DontShow: false
AcceptedValues: []
HelpMessage: ''

-GroupID

Optional. Group ID

Type: System.Int32
DefaultValue: 0
SupportsWildcards: false
Aliases: []
ParameterSets:
- Name: (All)
  Position: 6
  IsRequired: false
  ValueFromPipeline: false
  ValueFromPipelineByPropertyName: false
  ValueFromRemainingArguments: false
DontShow: false
AcceptedValues: []
HelpMessage: ''

-HomeDirectory

Optional. Home directory for the user. Default is "/home/$Name"

Type: System.String
DefaultValue: '"/home/$Name"'
SupportsWildcards: false
Aliases: []
ParameterSets:
- Name: (All)
  Position: 4
  IsRequired: false
  ValueFromPipeline: false
  ValueFromPipelineByPropertyName: false
  ValueFromRemainingArguments: false
DontShow: false
AcceptedValues: []
HelpMessage: ''

-Name

Name of the user to create

Type: System.String
DefaultValue: ''
SupportsWildcards: false
Aliases: []
ParameterSets:
- Name: (All)
  Position: 0
  IsRequired: true
  ValueFromPipeline: false
  ValueFromPipelineByPropertyName: false
  ValueFromRemainingArguments: false
DontShow: false
AcceptedValues: []
HelpMessage: ''

-NoHomeDirectory

Optional. Do not create a home directory

Type: System.Management.Automation.SwitchParameter
DefaultValue: False
SupportsWildcards: false
Aliases: []
ParameterSets:
- Name: (All)
  Position: Named
  IsRequired: false
  ValueFromPipeline: false
  ValueFromPipelineByPropertyName: false
  ValueFromRemainingArguments: false
DontShow: false
AcceptedValues: []
HelpMessage: ''

-Password

Optional. Password for the user. Must be a secure string.

Type: System.Security.SecureString
DefaultValue: ''
SupportsWildcards: false
Aliases: []
ParameterSets:
- Name: (All)
  Position: 3
  IsRequired: false
  ValueFromPipeline: false
  ValueFromPipelineByPropertyName: false
  ValueFromRemainingArguments: false
DontShow: false
AcceptedValues: []
HelpMessage: ''

-ShellPath

Optional. Path to the user's shell. Default is "/bin/bash"

Type: System.String
DefaultValue: /bin/bash
SupportsWildcards: false
Aliases: []
ParameterSets:
- Name: (All)
  Position: 5
  IsRequired: false
  ValueFromPipeline: false
  ValueFromPipelineByPropertyName: false
  ValueFromRemainingArguments: false
DontShow: false
AcceptedValues: []
HelpMessage: ''

-UID

Optional. User ID

Type: System.Int32
DefaultValue: 0
SupportsWildcards: false
Aliases: []
ParameterSets:
- Name: (All)
  Position: 1
  IsRequired: false
  ValueFromPipeline: false
  ValueFromPipelineByPropertyName: false
  ValueFromRemainingArguments: false
DontShow: false
AcceptedValues: []
HelpMessage: ''

CommonParameters

This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutBuffer, -OutVariable, -PipelineVariable, -ProgressAction, -Verbose, -WarningAction, and -WarningVariable. For more information, see about_CommonParameters.

INPUTS

OUTPUTS

NOTES

This function requires superuser privileges to create a user account. Ensure that you have the necessary permissions to run this command. Use with caution, as it will permanently create a new user account.

RELATED LINKS