PowerShell client for the Rackspace Cloud Office API
Switch branches/tags
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Failed to load latest commit information.
New-Release.ps1
README.md
RackspaceCloudOffice.psd1
RackspaceCloudOffice.psm1

README.md

A PowerShell client for the Rackspace Cloud Office API. See the API documentation for full details on the calls you can make.

Syntax

Set up config values:

Set-RsCloudOfficeConfig [[-ConfgFile] <String>] [[-UserKey] <String>]
    [[-SecretKey] <String>] [[-BaseUrl] <String>]

Making a request:

$bodyData | Invoke-RsCloudOfficeRequest [[-Method] <String>] [-Path] <String>
    [[-UnpaginateProperty] <String>] [<CommonParameters>]

Getting Started

Pre-requisites

(Already comes with Windows 8, Server 2008 and newer)

Installation

PowerShell Gallery
PS > Install-Module RackspaceCloudOffice

Note: PowerShell 5+ is required to install from the gallery

Manual Install
  1. Download the latest release .zip
  2. Important Unblock the downloaded .zip file
  3. Extract the .zip file to %USERPROFILE%\Documents\WindowsPowerShell\Modules

(So that the .psm1 file is extracted to: %USERPROFILE%\Documents\WindowsPowerShell\Modules\RackspaceCloudOffice\RackspaceCloudOffice.psm1)

Now you should be able to open PowerShell and run Invoke-RsCloudOfficeRequest.

API Keys

In order to make any API calls, you will need API keys. If you need to generate new ones, log in to the Cloud Office Control Panel, then go to the API keys page.

API Keys screenshot

Screenshot of the API keys page

For convenience, you can save your API keys to a config file so that you don't have to pass them every time:

Set-RsCloudOfficeConfig -UserKey pugSoulpxYmQDQiY6f1j -SecretKey bI4+E0cV93qigYKuC+sRAJkqyMlc6CThXr9CDXjc

(Replace the example keys with your actual keys)

When you are finished interacting with the API, you may optionally delete the config file at %LOCALAPPDATA%\RsCloudOfficeApi.config so that your keys aren't left on the computer.

Example Usage

Admins

Note: In all the example URLs, replace jane.doe with the name of the admin you want to act on.

List All Admins
Invoke-RsCloudOfficeRequest /v1/customers/me/admins -UnpaginateProperty admins |
    Format-Table -AutoSize
Add An Admin
$newAdmin = @{
    type = 'super'
    password = 'Password!1'
    firstName = 'Jane'
    lastName = 'Doe'
    email = 'jane.doe@example.com'
    securityQuestion = 'what is delicious'
    securityAnswer = 'candy'
}
$newAdmin | Invoke-RsCloudOfficeRequest -Method Post /v1/customers/me/admins/jane.doe
Get Details On A Specific Admin
Invoke-RsCloudOfficeRequest /v1/customers/me/admins/jane.doe
Edit An Admin
@{ firstName = 'New Name' } |
    Invoke-RsCloudOfficeRequest -Method Put /v1/customers/me/admins/jane.doe
Delete An Admin
Invoke-RsCloudOfficeRequest -Method Delete /v1/customers/me/admins/jane.doe

Domains

List All Domains
Invoke-RsCloudOfficeRequest /v1/customers/me/domains -UnpaginateProperty domains |
    Format-Table -AutoSize

Exchange Mailboxes

Note: In all the example URLs, replace example.com with your domain and replace jane.doe with the name of the mailbox to act on.

List All Mailboxes
Invoke-RsCloudOfficeRequest /v1/customers/me/domains/example.com/ex/mailboxes `
    -UnpaginateProperty mailboxes | Format-Table -AutoSize
Add A Mailbox
$newMailbox = @{
    displayName = 'Jane Doe'
    password = 'Password!1'
    size = 10*1024
}
$newMailbox | Invoke-RsCloudOfficeRequest -Method Post `
    /v1/customers/me/domains/example.com/ex/mailboxes/jane.doe
Get Details Of A Specific Mailbox
Invoke-RsCloudOfficeRequest /v1/customers/me/domains/example.com/ex/mailboxes/jane.doe
Edit A Mailbox
@{ firstName = 'New Name' } | Invoke-RsCloudOfficeRequest -Method Put `
    /v1/customers/me/domains/example.com/ex/mailboxes/jane.doe
Delete A Mailbox
Invoke-RsCloudOfficeRequest -Method Delete `
    /v1/customers/me/domains/example.com/ex/mailboxes/jane.doe

Rackspace Mailboxes

Note: In all the example URLs, replace example.com with your domain and replace jane.doe with the name of the mailbox to act on.

List All Mailboxes
Invoke-RsCloudOfficeRequest /v1/customers/me/domains/example.com/rs/mailboxes `
    -UnpaginateProperty rsMailboxes | Format-Table -AutoSize
Add A Mailbox
$newMailbox = @{
    password = 'Password!1'
    size = 25*1024
}
$newMailbox | Invoke-RsCloudOfficeRequest -Method Post `
    /v1/customers/me/domains/example.com/rs/mailboxes/jane.doe
Get Details Of A Specific Mailbox
Invoke-RsCloudOfficeRequest /v1/customers/me/domains/example.com/rs/mailboxes/jane.doe
Edit A Mailbox
@{ firstName = 'New Name' } | Invoke-RsCloudOfficeRequest -Method Put `
    /v1/customers/me/domains/example.com/rs/mailboxes/jane.doe
Delete A Mailbox
Invoke-RsCloudOfficeRequest -Method Delete `
    /v1/customers/me/domains/example.com/rs/mailboxes/jane.doe

See Also