A PowerShell module that sets up a computer to run NServiceBus with the MSMQ transport.
The PowerShell module provides cmdlets to assist with:
- Installing Microsoft Message Queuing Service (MSMQ)
- Configuring Microsoft Distributed Transaction Coordinator (MSDTC)
- Setting the addresses of the default Error and Audit queues for use by deployed Endpoints
- Importing a Particular Platform license into the Registry
Prerequisites
Prior to installation, ensure that PowerShell 5 is installed. Versions of PowerShell later than 5, including PowerShell Core, are not supported by the module and may not work as expected.
PowerShell 5 and under are no longer supported by Microsoft.
You can confirm which PowerShell version you have installed by running the following PowerShell cmdlet.
$PSVersionTable.PSVersion
In order to run PowerShell cmdlets, the PowerShell execution policy must be set to Unrestricted
or a bypass must be granted to the module file. Refer to PowerShell documentation on how to change the execution policy.
Installation
The installation file for the module can be downloaded here.
The NServiceBus.PowerShell repository used for MSMQ is no longer maintained, and has been archived. As MSMQ is not available for .NET (Core), building new systems using MSMQ is not recommended.
Usage
After installation, the module can be loaded into a PowerShell session by issuing the following PowerShell cmdlet:
Import-Module NServiceBus.PowerShell
The installation adds the NServiceBus.PowerShell module location to the PSModulePath
environment variable. If the module isn't available, restarting the Windows session may be required for this change to take effect.
Most of the cmdlets require elevated privileges; the module should be used in a PowerShell session that is launched with Run As Administrator
.
Help
A list of available cmdlets can be found by issuing the following PowerShell cmdlet.
Get-Command -Module NServiceBus.PowerShell
Help for each cmdlet is incorporated within the module. Help can be accessed via the PowerShell Get-Help cmdlet, e.g. Get-Help Set-NServiceBusLocalMachineSettings
.
Troubleshooting
If you encounter issues when using the NServiceBus.PowerShell module, consider the following troubleshooting steps:
Check PowerShell Version: Ensure you are running PowerShell 5. Use the following PowerShell cmdlet to verify your version:
$PSVersionTable.PSVersion
Module Not Recognized: If the module is not recognized, verify that the installation path is included in the
PSModulePath
environment variable. Restart your Windows session if necessary.Execution Policy Errors: If you receive errors related to script execution policies, ensure the policy is set to
Unrestricted
or that a bypass is granted to the module file. Refer to PowerShell documentation for details.Administrator Privileges: Some cmdlets require elevated privileges. Try running PowerShell as Administrator.
Module Maintenance: The NServiceBus.PowerShell module is no longer maintained and may not be compatible with newer versions of Windows or PowerShell. Consider alternative approaches or transports if you encounter persistent issues.