Chat tools may have started out for simple communication, but many organizations are now leveraging chat to streamline their operations. This is known as ChatOps (or Chat Operations and Chat Automation), which aims to automate tasks, execute workflows, and retrieve the results directly in chat. In this post, we’ll look at the benefits of ChatOps and how to get started using Rubrik and PoshBot in combination with Slack.

Advantages of ChatOps

Before we dive into the technical specifics, let’s first answer the question: Why use ChatOps to automate anything?

There are several reasons for using ChatOps, but one of the biggest reasons is that in most organizations, we are already using a form of chat interaction to communicate with teammates. Leveraging a familiar interface to automate tasks makes it much easier to expose scripts and workflows to non-technical users who would otherwise not have access.

Another advantage is that the learning curve of using ChatOps is quite low. If a bot is added to an existing chat channel, everyone in the channel can see how a command is executed, which reduces both the learning curve and context switching. Instead of asking for help, a user with sufficient privileges is able to solve their issues or request right from chat.

Finally, because we are using ChatOps, we can execute these tasks from any platform. This means that we can check up on tasks by logging into Slack, run a task, or even resolve an issue from any other device.

Getting Started with Rubrik Module for PoshBot

PoshBot is an open source chat bot written in PowerShell and maintained on GitHub that’s designed to run on-premises or in the cloud. Because PoshBot can run on any platform with PowerShell, it is easy to integrate into your environment. PoshBot is not limited to executing just PowerShell, and other scripting languages or external tools can also be called through PoshBot.

To get started, we first need to install and configure PoshBot on our system. To follow the examples in this post, you will need:

In order to get the token to authenticate with Slack, you’ll need administrative access to your Slack workspace. Alternatively, it’s possible to create your own Slack workspace for testing purposes.

To get started with your own instance of PoshBot, follow the steps in the Rubrik Module for PoshBot Quickstart Guide.

ChatOps with Roxie

At Rubrik, we use Roxie as our open source mascot to share code samples and training materials and to engage with the open source community. For the purpose of these demos, we’ve named our PoshBot instance Roxie.

After installing and configuring the bot, we can invite the bot into our Slack channel and begin using it. We’ve configured the chat bot to respond to Roxie so that every subsequent command will be processed as a command.

When you send a message to Slack, the command is processed by PoshBot, as shown in the diagram below:



Bringing this into practice, let’s start our initial conversation with Roxie to see what’s possible. In the first example, we ask Roxie about which Rubrik specific commands are available to us:


We use the hello command to have Roxie introduce herself and her capabilities:

Note that we can continue this interactive conversation and even have Roxie respond in different languages using machine translation.

A Look Behind the Scenes: The PowerShell Code

If you’re already familiar with writing PowerShell or other scripting or programming languages, then you’re probably wondering how this works. So, let’s take a look at part of the code of one of the functions in the Rubrik PoshBot module Get-PBRubrikVersion:



In the above code, we can see the following steps:

  1. Connecting to the Rubrik Cluster
  2. Getting the version information
  3. Adding the results to the $ResponseSplat hash table
  4. Formatting the output in that hash table using Format-PBRubrikObject
  5. Send the output back to Slack using the PoshBot function New-PoshBotTextResponse

Restoring Files and Workloads with PoshBot

In the next example, we’ll use the Rubrik module for PoshBot to Live Mount a VM and then return a .rdp file that we can directly connect to our VM. This can be used to quickly spin up a temporary VM based off your backups to facilitate instant recovery or for testing purposes:


Another common use case is using the Rubrik module for PoshBot for a file restore. This is as simple as starting a discussion with Roxie. She will guide us through the process of restores so the user can  facilitate the restore (assuming they have the correct permissions applied).

In the below example, we will have Roxie restore the file directly to the VM in an alternate folder:

Alternatively, we can have Roxie send the file as an attachment directly in Slack:

Moving Forward with ChatOps

The examples provided in this post are just scratching the surface of what is possible with ChatOps. There are a lot of exciting possibilities when you integrate your scripts and Rubrik workflows directly into Slack.

If you are looking to get started with the Rubrik Module for PoshBot and build out your own commands and integrations, head over to our GitHub repository: Rubrik Module for PoshBot

Or get started right away by installing the module in PowerShell directly from the PowerShell Gallery:


Interested in contributing to Rubrik Build or the Rubrik Module for PoshBot? Take a look at our contributor guide and discover the many ways you can get started!