New-D09SQLUser
SYNOPSIS
Create a new SQL user in a specified database.
SYNTAX
New-D09SQLUser [-SQLDBName] <String> [-SQLServer] <String> [-SQLPermissions] <String>
[[-PwdstateListID] <String>] [[-Username] <String>] [<CommonParameters>]
DESCRIPTION
This function creates a new SQL user in a specified database with the desired permissions (Read, Write, or Admin). It generates a secure password for the user, assigns the appropriate permissions, and optionally stores the credentials in Passwordstate.
EXAMPLES
EXAMPLE 1
Creates a new SQL user with read-only permissions in the "TestDB" database on "SQLInstance1".
EXAMPLE 2
New-D09SQLUser -SQLDBName "ProdDB" -SQLServer "SQLInstance2" -SQLPermission "A" -Username "CustomAdmin"
Creates a new SQL user named "CustomAdmin" with admin permissions in the "ProdDB" database on "SQLInstance2".
EXAMPLE 3
New-D09SQLUser -SQLDBName "FinanceDB" -SQLServer "SQLInstance3" -SQLPermission "W" -PasswordstateListID 123
Creates a new SQL user with read/write/execute permissions in the "FinanceDB" database on "SQLInstance3" and stores the credentials in Passwordstate list ID 123.
PARAMETERS
-SQLDBName
The name of the database where the SQL user will be created.
Type: String
Parameter Sets: (All)
Aliases:
Required: True
Position: 1
Default value: None
Accept pipeline input: False
Accept wildcard characters: False
-SQLServer
The name of the SQL Server instance where the database resides.
Type: String
Parameter Sets: (All)
Aliases:
Required: True
Position: 2
Default value: None
Accept pipeline input: False
Accept wildcard characters: False
-SQLPermissions
{{ Fill SQLPermissions Description }}
Type: String
Parameter Sets: (All)
Aliases:
Required: True
Position: 3
Default value: None
Accept pipeline input: False
Accept wildcard characters: False
-PwdstateListID
{{ Fill PwdstateListID Description }}
Type: String
Parameter Sets: (All)
Aliases:
Required: False
Position: 4
Default value: 733
Accept pipeline input: False
Accept wildcard characters: False
-Username
An alternative SQL username. If not provided, a default username will be generated based on the database name and permission type.
Type: String
Parameter Sets: (All)
Aliases:
Required: False
Position: 5
Default value: Default
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.
INPUTS
OUTPUTS
NOTES
CHANGELOG 2024-09-03 - MM - Herwerking van het oude script dat enkel users met leesrechten kon aanmaken.