The Rubrik Security Cloud PowerShell module:
- Makes it easy to work with RSC from the command line
- Acts as an SDK to provide access to the RSC API for custom scripting
(For the community CDM SDK for PowerShell, please see: github.com/rubrikinc/rubrik-sdk-for-powershell)
Rubrik supports the commands and general functionality of this project. Rubrik cannot support custom script logic.
While this module may work with PowerShell 5.x, we recommend PowerShell >= 7.0. When troubleshooting, the first recommendation will be to upgrade from 5.x.
To give feedback on this project, open a new discussion.
Visit the Rubrik Developer Center PowerShell documentation for official installation instructions.
While we recommend using the PowerShell Gallery to install, advanced users may install the module from source.
Start by cloning the repo:
git clone [email protected]:rubrikinc/rubrik-powershell-sdk.git
cd rubrik-powershell-sdkThen install the module from local sources:
./Utils/Import-RscModuleFromLocalOutputDir.ps1At this point you can follow the Connecting to RSC instructions on the Developer Center.
Once connected, check that your version of the module is not too far off from the version of the API server. Run:
PS> Get-RscVersion
SdkSchemaVersion ServerVersion
---------------- -------------
v20230524-16 v20230524-16If your module version is too old, you will see a warning. You can still use the module, but you may not be able to use the latest features, and you may see some deprecation errors in your scripts. The module is generally backward compatible for a limited time. If you see deprecation errors when running your scripts, upgrade your module to the latest version as soon as possible.
You can then run any of the commands in the module, for example, to retrieve the current account info:
Get-RscAccount
Get-RscAccount -Detail
(Get-RscAccount).AccountIdTo list clusters:
$c=Get-RscCluster
$c # show all clusters
$c.Count # show number of clusters
$c[0] # show first cluster
$c.id # list cluster idsTo run raw GraphQL queries:
Invoke-Rsc -GqlQuery "query accountSettings{accountSettings{isEulaAccepted}}"
$vms=(Invoke-Rsc -GqlQuery
"query GetVsphereVmList{vSphereVmNewConnection{nodes{id name}}}").NodesTo see all cmdlets in the module:
(Get-Module RubrikSecurityCloud).ExportedCommands.Keys | Sort-ObjectThen to disconnect:
Disconnect-RscIt is good practice and recommended to finish your scripts
with Disconnect-Rsc. Note however that it is not strictly
necessary, as the connection will be closed automatically
when the session ends.
👉 Start with the RSC PowerShell Module Developer Manual. Once you've covered the basics on this page, the developer manual will teach you how to use the module to build your own scripts.
It refers to samples that demonstrate how to use the module; you can also peruse the samples directly.
Another great way to learn about the module is to look at its end-to-end (e2e) tests: tests/e2e
GraphQL schema reference: