Skip to content

Reset-DatabasePermissions

SYNOPSIS

Restore default database permissions after a restore.

SYNTAX

Reset-DatabasePermissions [-dbname] <String> [-SQLServer] <String> [<CommonParameters>]

DESCRIPTION

This function restores the default database permissions for a specified SQL Server database after a restore. It includes: - Recreating custom roles in the database. - Reassigning permissions to predefined roles and users. - Linking Active Directory groups to the database.

EXAMPLES

EXAMPLE 1

Reset-DatabasePermissions -dbname "TestDB" -SQLServer "SQLInstance1"

Restores the default permissions for the "TestDB" database on "SQLInstance1".

EXAMPLE 2

Reset-DatabasePermissions -dbname "ProdDB" -SQLServer "SQLInstance2"

Restores the default permissions for the "ProdDB" database on "SQLInstance2", including custom roles and AD group links.

PARAMETERS

-dbname

The name of the database for which permissions will be restored.

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

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