Remove‑SqlDscRole - dsccommunity/SqlServerDsc GitHub Wiki
Removes a server role from a SQL Server Database Engine instance.
Remove-SqlDscRole -ServerObject <Server> -Name <String> [-Force] [-Refresh]
[-WhatIf] [-Confirm] [<CommonParameters>]
Remove-SqlDscRole -RoleObject <ServerRole> [-Force] [-WhatIf] [-Confirm]
[<CommonParameters>]
This command removes a server role from a SQL Server Database Engine instance.
$serverObject = Connect-SqlDscDatabaseEngine -InstanceName 'MyInstance'
$roleObject = $serverObject | Get-SqlDscRole -Name 'MyCustomRole'
$roleObject | Remove-SqlDscRole
Removes the role named MyCustomRole.
$serverObject = Connect-SqlDscDatabaseEngine -InstanceName 'MyInstance'
$serverObject | Remove-SqlDscRole -Name 'MyCustomRole'
Removes the role named MyCustomRole.
$serverObject = Connect-SqlDscDatabaseEngine -InstanceName 'MyInstance'
$serverObject | Remove-SqlDscRole -Name 'MyCustomRole' -Force
Removes the role named MyCustomRole without prompting for confirmation.
Specifies that the role should be removed without any confirmation.
Type: SwitchParameter
Parameter Sets: (All)
Aliases:
Required: False
Position: Named
Default value: False
Accept pipeline input: False
Accept wildcard characters: False
Specifies the name of the server role to be removed.
Type: String
Parameter Sets: ServerObject
Aliases:
Required: True
Position: Named
Default value: None
Accept pipeline input: False
Accept wildcard characters: False
Specifies that the ServerObject's roles should be refreshed before trying to remove the role object. This is helpful when roles could have been modified outside of the ServerObject, for example through T-SQL. But on instances with a large amount of roles it might be better to make sure the ServerObject is recent enough, or pass in RoleObject.
Type: SwitchParameter
Parameter Sets: ServerObject
Aliases:
Required: False
Position: Named
Default value: False
Accept pipeline input: False
Accept wildcard characters: False
Specifies a server role object to remove.
Type: ServerRole
Parameter Sets: RoleObject
Aliases:
Required: True
Position: Named
Default value: None
Accept pipeline input: True (ByValue)
Accept wildcard characters: False
Specifies current server connection object.
Type: Server
Parameter Sets: ServerObject
Aliases:
Required: True
Position: Named
Default value: None
Accept pipeline input: True (ByValue)
Accept wildcard characters: False
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
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
This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see about_CommonParameters.