Unity-Powershell/Open Source Project

Branch AppVeyor Docs
master Build status Documentation Status
develop Build status Documentation Status
Last release: GitHub version

Unity-Powershell

This is a Powershell module for managing EMC Unity arrays (physical or virtual). Unity-Powershell is a member of the DevHigh5 program from {code} by Dell EMC(tm). With this module (version 0.15.0) you can manage:
  • System (DNS, NTP...)
  • Pools (virtual and physical deployments)
  • Fast Cache (physical deployments only)
  • LUN (block)
  • VMware LUN (block and NFS)
  • NASServer
  • Filesystem
  • CIFS Server and Shares
  • NFS Server and Shares
  • vCenter and ESXi servers
  • iSCSI parameters
  • Snapshots and snapshots schedules
  • Performance metrics
More functionality will be added later.

Usage

This module tries to mimic VMware PowerCLI usage. All resource management functions are available with the Powershell verbs GET, NEW, SET, REMOVE. For example, you can manage Pools with the following commands: - Get-UnityPool - New-UnityPool - Set-UnityPool - Remove-UnityPool Some functions accept pipelining. For example, if you want to delete all existing LUNs you can do this:
Get-UnityLUN | Remove-UnityLUN

Requirements

  • Powershell 5 (If possible get the latest version)
  • An EMC Unity array! (virtual or physical)

Instructions

Install the module

# Automated installation (Powershell 5):
    Install-Module Unity-Powershell

# Or manual setup
    # Download the repository
    # Unblock the zip
    # Extract the Unity-Powershell folder to a module path (e.g. $env:USERPROFILEDocumentsWindowsPowerShellModules)

# Import the module
    Import-Module Unity-Powershell # Alternatively, Import-Module \PathToUnity-Powershell

# Get commands in the module
    Get-Command -Module Unity-Powershell

# Get help
    Get-Help Get-UnityUser -Full
    Get-Help Unity-Powershell

Examples

Connecting to the Unity array

The first thing to do is to connect to an EMC Unity array with the command Connect-Unity:
# Connect to the Unity array
    Connect-Unity -Server 192.0.2.1

    Server       User  Name     Model    SerialNumber
    ------       ----  ----     -----    ------------
    192.0.2.1 admin UnityDemo UnityVSA VIRT1919K58MXM
The parameter -TrustAllCerts controls whether or not to accept untrusted certificates. It is set to $True by default.
# Connect to the Unity array without allowing untrusted certificates
    Connect-Unity -Server 192.0.2.1 -TrustAllCerts $false

    Server       User  Name     Model    SerialNumber
    ------       ----  ----     -----    ------------
    192.0.2.1 admin UnityDemo UnityVSA VIRT1919K58MXM

LUN Management

You can create a new LUN New-UnityLUN, retrieve its information Get-UnityLUN, modify its properties Set-UnityLUN, or delete it Remove-UnityLUN.
# Create a block LUN
    New-UnityLUN -Name 'LUN01' -Pool 'pool_1' -Size '10GB'

    Id    Name  Pool          IsThinEnabled TieringPolicy SizeTotal   SizeAllocated Type
    --    ----  ----          ------------- ------------- ---------   ------------- ----
    sv_94 LUN01 @{id=pool_1} True          Autotier_High 10737418240 0             Standalone


# Retrieve information about block LUN
    Get-UnityLUN

    Id    Name  Pool          IsThinEnabled TieringPolicy SizeTotal   SizeAllocated Type
    --    ----  ----          ------------- ------------- ---------   ------------- ----
    sv_94 LUN01 @{id=pool_1} True          Autotier_High 10737418240 0             Standalone
    sv_95 LUN02 @{id=pool_1} True          Autotier_High 10737418240 0             Standalone


# Delete a LUN
    Remove-UnityLUN -ID 'sv_95'

User Management

You can add a new user New-UnityUser, modify their properties Set-UnityUser, or delete them Remove-UnityUser.
# Retrieve information about a specific user
    Get-UnityUser -Name 'demo'

    Id        Name Role
    --        ---- ----
    user_demo demo @{id=storageadmin}

# Change the role of a user from storageadmin to operator
    Get-UnityUser -Name 'demo' | Set-UnityUser -Role 'operator'

    Id        Name Role
    --        ---- ----
    user_demo demo @{id=operator}  

# Delete a user
    Remove-UnityUser -ID 'user_demo'

Query resources

For testing purposes you can query all the resources of the array with the command Get-UnityItem. You have to provide the URI of the resource with the parameter -URI. It returns a Powershell object by default or a JSON item (with the parameter -JSON) without any formatting.
# Retrieve information about NTP servers. Result is a Powershell object
    $response = Get-UnityItem -URI '/api/types/ntpServer/instances?fields=id,addresses'
    $response.entries.content

    id addresses
    -- ---------
    0  {pool.ntp.org}

# Retrieve information about NTP servers. Result is in the JSON format
    $response = Get-UnityItem -URI '/api/types/ntpServer/instances?fields=id,addresses' -JSON

Disconnecting

# Disconnect from the EMC Unity Array
    Disconnect-Unity

Author

Erwan Quélin

Special Thanks

  • David Muegge for his blog post about using the EMC Unity API with Powershell
  • Warren F. for his blog post 'Building a Powershell module'
  • Chris Wahl for his blog posts about Powershell and REST API.

License

Copyright 2016-2017 Erwan Quelin and the community. Licensed under the MIT License.

From the {code} Blog

  • Automating Docker Swarm and REX-Ray installs in GCE with Ansible

    When it comes to managing your infrastructure and environments, you shouldn’t be doing anything by hand. We are big believers in “everything as code” here, from application to infrastructure. We are excited to announce a ...
    February 9, 2016
  • Introducing ViPR Command

    The ViPRCommand project started as an idea to provided current ViPR/CoprHD users the ability to interact with the storage platform as any other “shell lover” person will do in their Linux/Unix systems. The main concept ...
    September 7, 2015
  • Getting Free and Frictionless with ScaleIO

    EMC {code} is excited to be at the fore front of helping contribute to an EMC future state where we thrive by aligning to a technology landscape focused on Open-Source technologies and DevOps artifacts. So ...
    June 9, 2015
More related posts on the {code} Blog

Branch AppVeyor Docs
master Build status Documentation Status
develop Build status Documentation Status
Last release: GitHub version

Unity-Powershell

This is a Powershell module for managing EMC Unity arrays (physical or virtual). Unity-Powershell is a member of the DevHigh5 program from {code} by Dell EMC(tm). With this module (version 0.15.0) you can manage:
  • System (DNS, NTP...)
  • Pools (virtual and physical deployments)
  • Fast Cache (physical deployments only)
  • LUN (block)
  • VMware LUN (block and NFS)
  • NASServer
  • Filesystem
  • CIFS Server and Shares
  • NFS Server and Shares
  • vCenter and ESXi servers
  • iSCSI parameters
  • Snapshots and snapshots schedules
  • Performance metrics
More functionality will be added later.

Usage

This module tries to mimic VMware PowerCLI usage. All resource management functions are available with the Powershell verbs GET, NEW, SET, REMOVE. For example, you can manage Pools with the following commands: - Get-UnityPool - New-UnityPool - Set-UnityPool - Remove-UnityPool Some functions accept pipelining. For example, if you want to delete all existing LUNs you can do this:
Get-UnityLUN | Remove-UnityLUN

Requirements

  • Powershell 5 (If possible get the latest version)
  • An EMC Unity array! (virtual or physical)

Instructions

Install the module

# Automated installation (Powershell 5):
    Install-Module Unity-Powershell

# Or manual setup
    # Download the repository
    # Unblock the zip
    # Extract the Unity-Powershell folder to a module path (e.g. $env:USERPROFILEDocumentsWindowsPowerShellModules)

# Import the module
    Import-Module Unity-Powershell # Alternatively, Import-Module \PathToUnity-Powershell

# Get commands in the module
    Get-Command -Module Unity-Powershell

# Get help
    Get-Help Get-UnityUser -Full
    Get-Help Unity-Powershell

Examples

Connecting to the Unity array

The first thing to do is to connect to an EMC Unity array with the command Connect-Unity:
# Connect to the Unity array
    Connect-Unity -Server 192.0.2.1

    Server       User  Name     Model    SerialNumber
    ------       ----  ----     -----    ------------
    192.0.2.1 admin UnityDemo UnityVSA VIRT1919K58MXM
The parameter -TrustAllCerts controls whether or not to accept untrusted certificates. It is set to $True by default.
# Connect to the Unity array without allowing untrusted certificates
    Connect-Unity -Server 192.0.2.1 -TrustAllCerts $false

    Server       User  Name     Model    SerialNumber
    ------       ----  ----     -----    ------------
    192.0.2.1 admin UnityDemo UnityVSA VIRT1919K58MXM

LUN Management

You can create a new LUN New-UnityLUN, retrieve its information Get-UnityLUN, modify its properties Set-UnityLUN, or delete it Remove-UnityLUN.
# Create a block LUN
    New-UnityLUN -Name 'LUN01' -Pool 'pool_1' -Size '10GB'

    Id    Name  Pool          IsThinEnabled TieringPolicy SizeTotal   SizeAllocated Type
    --    ----  ----          ------------- ------------- ---------   ------------- ----
    sv_94 LUN01 @{id=pool_1} True          Autotier_High 10737418240 0             Standalone


# Retrieve information about block LUN
    Get-UnityLUN

    Id    Name  Pool          IsThinEnabled TieringPolicy SizeTotal   SizeAllocated Type
    --    ----  ----          ------------- ------------- ---------   ------------- ----
    sv_94 LUN01 @{id=pool_1} True          Autotier_High 10737418240 0             Standalone
    sv_95 LUN02 @{id=pool_1} True          Autotier_High 10737418240 0             Standalone


# Delete a LUN
    Remove-UnityLUN -ID 'sv_95'

User Management

You can add a new user New-UnityUser, modify their properties Set-UnityUser, or delete them Remove-UnityUser.
# Retrieve information about a specific user
    Get-UnityUser -Name 'demo'

    Id        Name Role
    --        ---- ----
    user_demo demo @{id=storageadmin}

# Change the role of a user from storageadmin to operator
    Get-UnityUser -Name 'demo' | Set-UnityUser -Role 'operator'

    Id        Name Role
    --        ---- ----
    user_demo demo @{id=operator}  

# Delete a user
    Remove-UnityUser -ID 'user_demo'

Query resources

For testing purposes you can query all the resources of the array with the command Get-UnityItem. You have to provide the URI of the resource with the parameter -URI. It returns a Powershell object by default or a JSON item (with the parameter -JSON) without any formatting.
# Retrieve information about NTP servers. Result is a Powershell object
    $response = Get-UnityItem -URI '/api/types/ntpServer/instances?fields=id,addresses'
    $response.entries.content

    id addresses
    -- ---------
    0  {pool.ntp.org}

# Retrieve information about NTP servers. Result is in the JSON format
    $response = Get-UnityItem -URI '/api/types/ntpServer/instances?fields=id,addresses' -JSON

Disconnecting

# Disconnect from the EMC Unity Array
    Disconnect-Unity

Author

Erwan Quélin

Special Thanks

  • David Muegge for his blog post about using the EMC Unity API with Powershell
  • Warren F. for his blog post 'Building a Powershell module'
  • Chris Wahl for his blog posts about Powershell and REST API.

License

Copyright 2016-2017 Erwan Quelin and the community. Licensed under the MIT License.

From the {code} Blog

  • Automating Docker Swarm and REX-Ray installs in GCE with Ansible

    When it comes to managing your infrastructure and environments, you shouldn’t be doing anything by hand. We are big believers in “everything as code” here, from application to infrastructure. We are excited to announce a ...
    February 9, 2016
  • Introducing ViPR Command

    The ViPRCommand project started as an idea to provided current ViPR/CoprHD users the ability to interact with the storage platform as any other “shell lover” person will do in their Linux/Unix systems. The main concept ...
    September 7, 2015
  • Getting Free and Frictionless with ScaleIO

    EMC {code} is excited to be at the fore front of helping contribute to an EMC future state where we thrive by aligning to a technology landscape focused on Open-Source technologies and DevOps artifacts. So ...
    June 9, 2015
More related posts on the {code} Blog

From the {code} Blog

  • Automating Docker Swarm and REX-Ray installs in GCE with Ansible

    When it comes to managing your infrastructure and environments, you shouldn’t be doing anything by hand. We are big believers in “everything as code” here, from application to infrastructure. We are excited to announce a ...
    February 9, 2016
  • Introducing ViPR Command

    The ViPRCommand project started as an idea to provided current ViPR/CoprHD users the ability to interact with the storage platform as any other “shell lover” person will do in their Linux/Unix systems. The main concept ...
    September 7, 2015
  • Getting Free and Frictionless with ScaleIO

    EMC {code} is excited to be at the fore front of helping contribute to an EMC future state where we thrive by aligning to a technology landscape focused on Open-Source technologies and DevOps artifacts. So ...
    June 9, 2015
More related posts on the {code} Blog