Skip to main content
Matrix42 Self-Service Help Center

Interactive Usage of PowerShell


You can use the cmdlets in an interactive PowerShell session to configure your system. You must run commands to prepare the changes and store the changes in your application configuration afterward. The cmdlets are designed to be used in installation or update scripts, so you have to initialize a session and close the session to perform any task.

Preparing the session

Open an administrative Powershell command prompt. In case you want to perform any database changes and use integrated security, the user that opens the shell must have the necessary rights on the database server to perform these changes. Service account credentials are used for configuring the application components like Windows services or IIS app pools, it is not used to connect to your database in the interactive session!

As a first step you must import the DLL that contains the cmdlets:

Import-Module <PathToYourInstallation>\bin\matrix42.maintenance.cmdlets.dll -force

To start a session for configuration, use the following command:


The command expects a Credentials parameter that contains the credentials of your service user. To prepare this credentials parameter, use the Get-Credential command. These 2 commands will ask you for the credentials of the service account and start a new session for configuration.

$Credentials = Get-Credential
New-WMConfigurationSession -Credentials $Credentials

An example of how to create a credentials parameter without asking could be found in the sample scripts.

Performing Maintenance Tasks

2 different tasks will be performed as samples:

  • Deactivating and activating History
  • Configuring the Service Layer

Deactivating and activating History

Activating and deactivating History will make permanent changes to your database. 

Deactivating will detach any existing history DB from the system. This history DB cannot be attached again! It might be a useful operation for setting up a test system without a history. Or if you have lost for any reason your History database, you can remove the references to the old database.

To detach the History database use this command:


To attach a new database, run the following command: 

Enable-WMHistory -DatabaseName "M42Archive"

This command will create a new database M42Archive, the Schema table and attach it to your environment.

Reconfiguring Service Layer

To reconfigure the Service Layer of your system, use the following command:


This command reinitializes the Service Layer to use the default databases and the group AS_Administrators from some domain.

Initialize-WMServiceLayer -AppFabricAdminGroup "domain\AS_Administrators" -PersistenceDatabaseName M42InstanceStore -MonitoringDatabaseName M42Monitoring

In case you already have the same databases, the command will not change this configuration. It will always reapply all settings for the Web application and refresh the configuration files.

Performing Cache Configuration Changes

Starting from DWP v.11.0, the following PowerShell commands are available to manage Matrix42 Software cache provider: 

  • Get-WMCacheConfiguration 

  • Set-WMCacheConfiguration 

Both commands are intended to directly interact with SPS.config to obtain current Redis connection settings or set them explicitly. 

Initially Cache Configuration is performed during DWP installation. See also Installation: Step by Step page, Cache Configuration: In-Memory or Redis cache provider section.

To get the settings, invoke the following command: 


The command doesn’t accept any arguments. The output is going to be printed as shown below (sample): 

Host: localhost 
Port: 6379
Username: admin
Database: 0
UseSsl: true

To set the settings, invoke the following command: 

Set-WMCacheConfiguration –Host “” -Port “6379” -Username “” -Password “” -Database 0 –UseSsl $true 

The corresponding properties will be set to SPS.config.

The database value must be in the range of 0 to 15. The command refuses databases out of this range. If that rule is violated, the error message will be displayed. 

  • Was this article helpful?