Set-CsUserDatabaseState
Enables or disables one or more Skype for Business Server user databases. This cmdlet was introduced in Lync Server 2010.
Syntax
Identity
Set-CsUserDatabaseState
[-Identity] <String>
[-Online] <Boolean>
[-Force]
[-WhatIf]
[-Confirm]
[<CommonParameters>]
RegistrarPool
Set-CsUserDatabaseState
[-Online] <Boolean>
-RegistrarPool <Fqdn>
[-Force]
[-WhatIf]
[-Confirm]
[<CommonParameters>]
Description
Skype for Business Server employs the user database (also known as the user store) to maintain presence and routing information for Skype for Business Server users.
The Set-CsUserDatabaseState
cmdlet provides a way for you change the state of one or more user databases: you can use the cmdlet to take a database offline or to bring a disabled database back online.
Note that, by default, the firewall exceptions for SQL Server Express are not enabled when you install the Standard Edition of Skype for Business Server.
In turn, that means that you will not be able to run the Set-CsUserDatabaseState
cmdlet from a remote instance of Windows PowerShell.
That's because your command will not be able to traverse the firewall and access the SQL Server Express database.
You can still run the cmdlet locally (that is, on the Standard Edition server itself).
However, to run the Set-CsUserDatabaseState
cmdlet remotely you will need to manually enable the firewall exceptions for SQL Server Express.
Examples
Example 1
Set-CsUserDatabaseState -Identity "UserDatabase:atl-sql-001.litwareinc.com" -Online $False
The command shown in Example 1 takes the user database UserDatabase:atl-sql-001.litwareinc.com offline. This is done by setting the Online property to $False.
Example 2
Set-CsUserDatabaseState -RegistrarPool atl-cs-001.litwareinc.com -Online $False
In Example 2, all the user databases on the Registrar pool atl-cs-001.litwareinc.com
are taken offline.
Example 3
Get-CsUserDatabaseState | Where-Object {$_.Online -eq $False} | ForEach-Object {Set-CsUserDatabaseState -Identity $_.Identity -Online $True}
Example 3 locates all the user databases that are currently offline and then brings them back online.
To do this, the command first calls the Get-CsUserDatabaseState
cmdlet without any parameters in order to return a collection of all the user databases in the organization.
This collection is then piped to the Where-Object
cmdlet, which picks out only those databases where the Online property is equal to False.
The filtered collection is then piped to the ForEach-Object
cmdlet, which takes each database in the collection and sets the Online property to True.
Note that the collection of offline databases must be piped to the ForEach-Object
cmdlet rather than the Set-CsUserDatabaseState
cmdlet.
That is because the latter cmdlet cannot directly accept pipelined information.
Parameters
-Confirm
Applicable: Lync Server 2010, Lync Server 2013, Skype for Business Server 2015, Skype for Business Server 2019
Prompts you for confirmation before executing the command.
Parameter properties
Type: | SwitchParameter |
Default value: | None |
Supports wildcards: | False |
DontShow: | False |
Aliases: | cf |
Parameter sets
(All)
Position: | Named |
Mandatory: | False |
Value from pipeline: | False |
Value from pipeline by property name: | False |
Value from remaining arguments: | False |
-Force
Applicable: Lync Server 2010, Lync Server 2013, Skype for Business Server 2015, Skype for Business Server 2019
Suppresses the display of any non-fatal error message that might arise when running the command.
Parameter properties
Type: | SwitchParameter |
Default value: | None |
Supports wildcards: | False |
DontShow: | False |
Parameter sets
(All)
Position: | Named |
Mandatory: | False |
Value from pipeline: | False |
Value from pipeline by property name: | False |
Value from remaining arguments: | False |
-Identity
Applicable: Lync Server 2010, Lync Server 2013, Skype for Business Server 2015, Skype for Business Server 2019
Unique identifier of the user database whose online status is to be modified. For example:
-Identity "UserDatabase:atl-sql-001.litwareinc.com"
You cannot use both Identity and RegistrarPool in the same command, nor can you use wildcards with either parameter.
Parameter properties
Type: | String |
Default value: | None |
Supports wildcards: | False |
DontShow: | False |
Parameter sets
Identity
Position: | 2 |
Mandatory: | True |
Value from pipeline: | True |
Value from pipeline by property name: | False |
Value from remaining arguments: | False |
-Online
Applicable: Lync Server 2010, Lync Server 2013, Skype for Business Server 2015, Skype for Business Server 2019
When set to True ($True), makes a database available online. When set to False ($False), takes a database offline.
Parameter properties
Type: | Boolean |
Default value: | None |
Supports wildcards: | False |
DontShow: | False |
Parameter sets
(All)
Position: | 2 |
Mandatory: | True |
Value from pipeline: | False |
Value from pipeline by property name: | False |
Value from remaining arguments: | False |
-RegistrarPool
Applicable: Lync Server 2010, Lync Server 2013, Skype for Business Server 2015, Skype for Business Server 2019
Fully qualified domain name (FQDN) of the Registrar pool hosting the user databases whose online status is to be modified. For example:
-RegistrarPool atl-cs-001.litwareinc.com
You cannot use both -Identity and -RegistrarPool in the same command, nor can you use wildcards with either parameter.
Parameter properties
Type: | Fqdn |
Default value: | None |
Supports wildcards: | False |
DontShow: | False |
Parameter sets
RegistrarPool
Position: | Named |
Mandatory: | True |
Value from pipeline: | False |
Value from pipeline by property name: | False |
Value from remaining arguments: | False |
-WhatIf
Applicable: Lync Server 2010, Lync Server 2013, Skype for Business Server 2015, Skype for Business Server 2019
Describes what would happen if you executed the command without actually executing the command.
Parameter properties
Type: | SwitchParameter |
Default value: | None |
Supports wildcards: | False |
DontShow: | False |
Aliases: | wi |
Parameter sets
(All)
Position: | Named |
Mandatory: | False |
Value from pipeline: | False |
Value from pipeline by property name: | False |
Value from remaining arguments: | False |
CommonParameters
This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutBuffer, -OutVariable, -PipelineVariable, -ProgressAction, -Verbose, -WarningAction, and -WarningVariable. For more information, see about_CommonParameters.
Inputs
System.String
The Set-CsUserDatabaseState
cmdlet accepts a string value representing the Identity of the user database to be updated.
Outputs
None
Instead, the Set-CsUserDatabaseState
cmdlet modifies existing instances of the Microsoft.Rtc.Management.Xds.UserStoreState object.