Remove-MgmtSvcDatabaseUser

Removes a principal from the database.

Syntax

Remove-MgmtSvcDatabaseUser [-Confirm] [-ConnectionString <String>] [-Database <String>] [-Password <String>]
 -Schema <String> [-Server <String>] -User <String> [-UserName <String>] [-WhatIf] [<CommonParameters>]

Description

The Remove-MgmtSvcDatabaseUser cmdlet removes a principal account for a specified schema from the database.
Specify the user name and schema.

You can run this cmdlet from any computer in the deployment.
However, this cmdlet assumes that the database is on the local computer.
If the database is on another computer, you must use the Server, UserName, Password, and Database parameters, or a SQL connection string.
If you specify a connection string by using the ConnectionString parameter, that value takes precedence over the Server, UserName, Password, and Database parameters.

Use this cmdlet when uninstalling Windows Azure Pack for Windows Server.
When you uninstall the product, you must uninstall the databases and remove the database users.

Examples

Example 1: Remove a user account

PS C:\> Remove-MgmtSvcDatabaseUser -Schema "Usage" -User "MgmtSvc-Usage" -Database "Microsoft.MgmtSvc.Usage" -Password "PassWord!" -Server "ContosoSQLServer" -UserName "SysAdmin"
This command removes the user named MgmtSvc-Usage from the Usage schema in the database named Contoso.MgmtSvc.Usage. The command specifies the computer that runs SQL server as ContosoSQLServer. The command also specifies a user named SysAdmin, which has permissions to make this change, along with the password for that account.

Parameters

-Confirm

Prompts you for confirmation before running the cmdlet.

Type:SwitchParameter
Aliases:cf
Required:False
Position:Named
Default value:False
Accept pipeline input:False
Accept wildcard characters:False

-ConnectionString

Specifies an SQL connection string.

Type:String
Required:False
Position:Named
Default value:None
Accept pipeline input:False
Accept wildcard characters:False

-Database

Specifies a database name.

Type:String
Required:False
Position:Named
Default value:None
Accept pipeline input:False
Accept wildcard characters:False

-Password

Specifies a password.

Type:String
Required:False
Position:Named
Default value:None
Accept pipeline input:False
Accept wildcard characters:False

-Schema

Specifies a schema.

Type:String
Required:True
Position:Named
Default value:None
Accept pipeline input:False
Accept wildcard characters:False

-Server

Specifies the name of the computer on which the SQL database resides.

Type:String
Required:False
Position:Named
Default value:None
Accept pipeline input:False
Accept wildcard characters:False

-User

Specifies the user name of a principal.
The cmdlet removes this account from the database for the specified schema.

Type:String
Required:True
Position:Named
Default value:None
Accept pipeline input:False
Accept wildcard characters:False

-UserName

Specifies the name of a user account.

Type:String
Required:False
Position:Named
Default value:None
Accept pipeline input:False
Accept wildcard characters:False

-WhatIf

Shows what would happen if the cmdlet runs.
The cmdlet is not run.

Type:SwitchParameter
Aliases:wi
Required:False
Position:Named
Default value:False
Accept pipeline input:False
Accept wildcard characters:False