Getting Started
Architecture
NServiceBus
Persistence
ServiceInsight
ServicePulse
ServiceControl
Monitoring
Modernization
Samples

Management using PowerShell

A PowerShell module that sets up a computer to run NServiceBus with the MSMQ transport.

The PowerShell module provides cmdlets to assist with:

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.

You can confirm which PowerShell version you have installed by running the following PowerShell cmdlet.

$PSVersionTable.PSVersion

Installation

The installation file for the module can be downloaded here.

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.

Related Articles