New-SysAccount
SYNOPSIS
Creates a new system account in Active Directory.
SYNTAX
New-SysAccount [-Username] <String> [[-Description] <String>] [-TaskNr] <String> [[-OU] <String>] [-WhatIf]
[-Confirm] [<CommonParameters>]
DESCRIPTION
The `New-SysAccount` function creates a new system account in Active Directory. It generates a secure password using PasswordState, assigns the account to a specified organizational unit (OU), and ensures the account has specific attributes such as `PasswordNeverExpires` and `CannotChangePassword`.
EXAMPLES
EXAMPLE 1
New-SysAccount -Username "SysAccount1" -Description "Service account for application X" -TaskNr "12345"
Creates a new system account named "SysAccount1" with the specified description and task number.
EXAMPLE 2
New-SysAccount -Username "SysAccount2" -Description "Backup service account" -TaskNr "67890" -OU "OU=CustomOU,DC=example,DC=com"
Creates a new system account named "SysAccount2" in the specified organizational unit.
PARAMETERS
-Username
The username for the new system account. Must be between 5 and 20 characters.
Type: String
Parameter Sets: (All)
Aliases:
Required: True
Position: 1
Default value: None
Accept pipeline input: True (ByPropertyName, ByValue)
Accept wildcard characters: False
-Description
A description for the system account.
Type: String
Parameter Sets: (All)
Aliases:
Required: False
Position: 2
Default value: None
Accept pipeline input: True (ByPropertyName)
Accept wildcard characters: False
-TaskNr
The task number associated with the creation of the system account.
Type: String
Parameter Sets: (All)
Aliases:
Required: True
Position: 3
Default value: None
Accept pipeline input: True (ByPropertyName)
Accept wildcard characters: False
-OU
The organizational unit (OU) where the system account will be created. Defaults to `OU=SYS_accounts,OU=Infrastructuur,DC=gentgrp,DC=gent,DC=be`.
Type: String
Parameter Sets: (All)
Aliases:
Required: False
Position: 4
Default value: OU=SYS_accounts,OU=Infrastructuur,DC=gentgrp,DC=gent,DC=be
Accept pipeline input: True (ByPropertyName)
Accept wildcard characters: False
-WhatIf
Shows what would happen if the cmdlet runs. The cmdlet is not run.
Type: SwitchParameter
Parameter Sets: (All)
Aliases: wi
Required: False
Position: Named
Default value: None
Accept pipeline input: False
Accept wildcard characters: False
-Confirm
Prompts you for confirmation before running the cmdlet.
Type: SwitchParameter
Parameter Sets: (All)
Aliases: cf
Required: False
Position: Named
Default value: None
Accept pipeline input: False
Accept wildcard characters: False
CommonParameters
This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see about_CommonParameters.