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 command New-WMConfigurationSession, 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 and configuring the service layer.
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 DB, you can remove the references to the old DB.
To detach the history DB use this command
To attach a new DB use this
Enable-WMHistory -DatabaseName "M42Archive"
This command will create a new DB M42Archive, create the table Schema and attach it to your environment.
To reconfigure the service layer of your system, use the Initialize-WMServiceLayer 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.