Loading...

I am happy to announce a HUGE release of the PowerShell SDK, version 1.13. With this new release the version naming adopts the REST API version that is supported as part of the SDK. This should help remove confusion for the latest version of the REST API that is supported with new releases of the SDK.

Installation process is the same from the PowerShell Gallery (PSGallery).

PS C:\> Set-PSRepository -Name PSGallery -InstallationPolicy Trusted
PS C:\> Install-Module -Name PureStoragePowerShellSDK -RequiredVersion 1.13.0.3

Note: Use Set-PSRepository to enable the PSGallery as Trusted to avoid the Untrusted message.

New -Filter Parameter for FlashArray Remote Filtering

A new parameter, -Filter, has been added for any cmdlet that supports returning multiple objects. The cool thing about using the -Filter parameter is that is provides FlashArray filtering vs client-side filtering (Eg. Where-Object). This can be very beneficial when working with large amounts of volumes, snapshots or hosts so a large dataset is not returned to the client. It would be great to get feedback on this new parameter, add a comment here or ping me via twitter (@8arkz).

PS C:\> $MyFlashArray = New-PfaArray -EndPoint 10.21.201.57 -UserName pureuser -IgnoreCertificateError

cmdlet New-PfaArray at command pipeline position 1
Supply values for the following parameters:
(Type !? for Help.)
Password: ********
PS C:\> Get-PfaVolumes -Array $MyFlashArray -Filter "Name='*Server*'" | Format-Table -AutoSize

To get help using this new -Filter parameter use the following:

PS C:\> Get-Help -Name about_Purity_Filtering
TOPIC
    about_Purity_Filtering

SHORT DESCRIPTION
    Describes how PureStoragePowerShellSDK cmdlets support filtering to narrow down results.

LONG DESCRIPTION
    The PureStoragePowerShellSDK supports filtering for various methods that might return multiple objects. The 
filter query parameter narrows down the results of a request to only the response objects that satisfy the filter 
criteria. Cmdlets that support filtering expose the -Filter parameter that takes a string representing the filter 
criteria.

New ActiveCluster Cmdlets

A lot of the work in SDK 1.13 corresponds to the latest release of Purity 5.x. In the new version Purity we introduced ActiveCluster for synchronous replication.

  • Add-PfaArrayToPod
  • Copy-PfaPod
  • Get-PfaAllPodFootprint
  • Get-PfaAllPodMediator
  • Get-PfaAllPodSpaceHistory
  • Get-PfaAllPodSpaces
  • Get-PfaNamedPodFootprint
  • Get-PfaNamedPodMediator
  • Get-PfaNamedPodSpace
  • Get-PfaNamedPodSpaceHistory
  • Get-PfaNamedPods
  • Get-PfaPendingDeletePods
  • Get-PfaPendingPodFootprint
  • Get-PfaPendingPodMediator
  • Get-PfaPendingPodSpace
  • Get-PfaPod
  • Get-PfaPods
  • New-PfaPod
  • Remove-PfaArrayFromPod
  • Remove-PfaPod
  • Rename-PfaPod
  • Restore-PfaPod
  • Get-PfaRemoteHost
  • Get-PfaRemoteHostGroup
  • Get-PfaRemoteHostGroupVolumeConnections
  • Get-PfaRemoteHostGroups
  • Get-PfaRemoteHosts
  • Get-PfaRemoteVolumeHostConnections
  • Get-PfaRemoteVolumeHostGroupConnections
  • Get-PfaVolumeConnection

Example of adding and removing a volume from a Pod:

PS C:\> Add-PfaVolumeToContainer -Array $MyFlashArray -Container 'TEST-POD' -Name 'TEST-PODVOLUME'

source :
serial : 45084F3508BF461400012564
created : 5/16/2018 11:28:28 AM
name : TEST-POD::TEST-PODVOLUME
size : 1099511627776

PS C:\> Remove-PfaVolumeFromContainer -Array $MyFlashArray -Name 'TEST-POD::TEST-PODVOLUME'

source :
serial : 45084F3508BF461400012564
created : 5/16/2018 11:28:28 AM
name : TEST-PODVOLUME
size : 1099511627776

New Named Certificate Management Cmdlets
  • Get-PfaNamedCertificate
  • Get-PfaNamedCertificateAttribute
  • Get-PfaNamedCertificateAttributes
  • Import-PfaNamedCertificate
  • Remove-PfaNamedCertificate
  • New-PfaNamedCertificateImport
  • New-PfaNamedSelfSignedCertificate
New Mirrored IO Statistics Cmdlets

Retrieves  performance statistics for I/Os that have been mirrored as part of ActiveCluster.

  • Get-PfaAllHostGroupIOMetricsMirrored
  • Get-PfaAllHostIOMetricsMirrored
  • Get-PfaAllPodIOMetricsMirrored
  • Get-PfaAllVolumeIOMetricsMirrored
  • Get-PfaArrayIOMetricsMirrored
  • Get-PfaHostGroupIOMetricsMirrored
  • Get-PfaHostIOMetricsMirrored
  • Get-PfaPodIOMetricsMirrored
  • Get-PfaVolumeIOMetricsMirrored
New Cmdlets to Support Key Management 
  • Get-PfaKmip
  • Get-PfaKmips
  • New-PfaKmip
  • Remove-PfaKmip
  • Test-PfaKmip
  • Update-PfaKmip
New Purity Run Cmdlet
  • Get-PfaPureAppsAttributes

Example of retrieving Purity Run app status. Today we support Windows Files Services (WFS) that uses Microsoft Windows Server 2016 Standard edition to run file services with Failover Clustering.

New Volume Group and VVol Cmdlets
  • Get-PfaAllVolumeGroupIOMetrics
  • Get-PfaAllVolumeGroupIOMetricsByTimeRange
  • Get-PfaAllVolumeGroupsIOMetricsAverage
  • Get-PfaAllVolumeGroupsIOMetricsTotal
  • Get-PfaVolumeGroupIOMetrics
  • Get-PfaVolumeGroupIOMetricsAverage
  • Get-PfaVolumeGroupIOMetricsByTimeRange
  • Get-PfaVolumeGroupSpaceMetrics
  • Get-PfaVolumeGroupSpaceMetrics
  • Get-PfaNamedVolumeGroupsIOMetricsByTimeRange
  • Get-PfaNamedVolumeGroups
  • Get-PfaPendingDeleteVolumeGroups
  • Get-PfaProtocolEndpointVolumes
  • Get-PfaProtocolEndpointVolume
  • Get-PfaVolumeGroups
  • Get-PfaVolumeGroup
  • New-PfaHostGroupProtocolEndpointVolumeConnection
  • New-PfaHostProtocolEndpointVolumeConnection
  • New-PfaProtocolEndpointVolume
  • New-PfaVolumeGroup    
  • Remove-PfaVolumeGroup
  • Restore-PfaVolumeGroup
Additional New Cmdlets
  • Get-PfaArrayTCPConnection
  • Set-PfaSnmpManagerNotification

Phew! Lots of additions and more examples will be coming on my blog.

Thanks,
Barkz

Read Full Article
Visit website
  • Show original
  • .
  • Share
  • .
  • Favorite
  • .
  • Email
  • .
  • Add Tags 

In a previous post I detailed out the issue with Get-MPIOSetting value returns. This problem caused the Test-WindowsBestPractices cmdlet to not work. This new version of the Toolkit re-enables the use of Test-WindowsBestPractices cmdlet. The fix has been tested on 2012 R2, 2016 and 17093. Windows Server 2019 has fixed this issue.

No other improvements unfortunately. After Pure//Accelerate I will be working on integrating the SQL Server and VMware cmdlets into the Toolkit.

Problem put an issue in at https://github.com/PureStorage-OpenConnect/powershell-toolkit/issues.

Relieved….
—-Barkz

Read Full Article
Visit website
  • Show original
  • .
  • Share
  • .
  • Favorite
  • .
  • Email
  • .
  • Add Tags 

Today we launched the Pure Storage Hackathon! We ran a hackathon at Pure//Accelerate 2017 and we got a few participants so this year we went a bit bigger to allow more customers, partners and attendees to Pure//Accelerate 2018 to participate. We launched the event ~2 months ahead of the event so we can announce the winners during our DevOps days track.

Here is what you need to know to get started.  

//Hack.When();
  • Idea Collection: 4/10/18 – 4/20/18
  • Development: 4/21/18 – 5/21/18
  • End: 5/21/18 — This is when we will be judging.
//Hack.WhoCanJoin();
  • Developers or tech enthusiasts at Pure Storage customers and partners or those who “secretly” desire to be part of the Pure Storage community.
//Hack.WhatYouNeed();
  • Bring your disruptive idea and passion for coding. We’ll provide the online hackathon development environment with access to Purity 5.0 REST APIs or use our PowerShell SDK or Python Toolkit. Each individual or team will have access to a hosted environment with development tools (eg Visual Studio Code) and SDKs pre-installed. Along with access to our PowerShell SDK you can leverage our PureStorage.REST DLL to build C# applications. For an example of using C# see the PowerShell ISE Add-on.
//Hack.Where(); //Hack.Prizes();
  • Cool prizes will be awarded to the top 3 winners selected by our judges.  

Let the ideas flow! 

Cheers,
Barkz

Read Full Article
Visit website
  • Show original
  • .
  • Share
  • .
  • Favorite
  • .
  • Email
  • .
  • Add Tags 

I’d like to introduce my first guest blogger, Miranda Steele. Miranda works on our REST API and FlashArray programmability team. She is extremely knowledge about our API, CLI and more. I couldn’t be happier having her contribute to my blog.

—————–

Hopefully everyone is aware of our REST API that can be used to script against FlashArray and FlashBlade arrays. And some writers on this blog are big fans of using PowerShell to interact with your Pure products. But what if you’re a simple lover of BASH? This blog post aims to explain some of the CLI scripting utilities that we have built into the Purity CLI. For the most part, all of these utilities exist on the latest Purity//FA and Purity//FB releases.

This post assumes that you are already familiar with the Purity CLI. If you aren’t, check out the CLI section of the user guide to learn more (FlashArray User GuideFlashBlade User Guide).

Getting into the FlashArray

Before we talk about CLI scripting, let’s talk about getting into the array. It’s always possible to enter your password in manually as you’re ssh-ing into the array (or to use a common utility like sshpass to enter your password in for you). But it’s worth mentioning that Purity//FA also has support for configuring a public key. For example if I…

miranda@flasharray001> pureadmin setattr --publickey
Enter key: ssh-rsa AAAAAAAAxAAAAAAxAAAAAAAAAAAxx miranda@pstg.com
Name      Public Key
miranda   ****

Now I can ssh in from the outside without being prompted for a password:

miranda@server$ ssh flasharray001 "purearray list"
Name           ID                                    Version  OS
flasharray001  4d90f65c-11a9-49a3-a54b-09c32e70fe56  5.0.1    Purity//FA
Simple Format Options

Alright, now that we’re able to ssh to our system easily using our public key, the next thing to mention are the CLI format options. These options transform the format of the CLI output in different useful ways.

Format options, for the most part, are common to all CLI commands:

format options: 
  --cli                 display as CLI commands
  --csv                 display as comma-separated values
  --notitle             hide column titles
  --nvp                 display as name-value pairs
  --raw                 display unformatted column titles and data
Let’s say my FlashArray has two volumes, vol1 and vol2. This is what the default “purevol list” output looks like:
miranda@server$ ssh flasharray001 "purevol list"
Name  Size  Source  Created                  Serial
vol1  1G    -       2018-01-17 15:52:02 PST  4D90F65C11A949A300011012
vol2  200M  -       2018-01-17 15:52:08 PST  4D90F65C11A949A300011013
Here’s that same “purevol list” output, with each of the format options.
  • “–csv” displays the output as comma-separated values. Note that it also transforms the values into a more machine-readable format. For example, the “Size” column changes from the human-readable string “1G” to the raw bytes value “1073741824”:
    miranda@server$ ssh flasharray001 "purevol list --csv"
    Name,Size,Source,Created,Serial
    vol1,1073741824,,2018-01-17 15:52:02,4D90F65C11A949A300011012
    vol2,209715200,,2018-01-17 15:52:08,4D90F65C11A949A300011013
  • “–notitle” simply gets rid of the first row of column titles:
    miranda@server$ ssh flasharray001 "purevol list --notitle"
    vol1  1G    -  2018-01-17 15:52:02 PST  4D90F65C11A949A300011012
    vol2  200M  -  2018-01-17 15:52:08 PST  4D90F65C11A949A300011013
  • “–nvp” stands for “name-value pairs”. This means that it returns output where each line takes the format “Key=Value”. One of the biggest advantages of “–nvp” is that your script will continue to work even if a subsequent upgrade adds a new column or changes the order of the columns:
    miranda@server$ ssh flasharray001 "purevol list --nvp"
    Name=vol1
    Size=1073741824
    Source=
    Created=2018-01-17 15:52:02
    Serial=4D90F65C11A949A300011012
    Name=vol2
    Size=209715200
    Source=
    Created=2018-01-17 15:52:08
    Serial=4D90F65C11A949A300011013
  • “–raw” shows the “raw” version of the column titles which can then be passed into the filter and sort options.  Additionally, like “–csv”, it transforms the values into a more machine-readable version.
    miranda@server$ ssh flasharray001 "purevol list --raw"
    name  size        source  created                  serial
    vol1  1073741824  -       2018-01-17 15:52:02 PST  4D90F65C11A949A300011012
    vol2  209715200   -       2018-01-17 15:52:08 PST  4D90F65C11A949A300011013

    Here’s a more interesting example of how the “–raw” flag can show different fields from the default list output:

    miranda@server$ sshpass -p pureuser ssh pureuser@flashblade001 "purefs list"
    Name               Size  Used   Created                  Protocols
    test_rest_fs_2     -     0.00   2018-01-26 13:45:00 PST  nfs
    test_rest_fs_snap  -     0.00   2018-01-26 13:45:11 PST  -
     
    miranda@server$ sshpass -p pureuser ssh pureuser@flashblade001 "purefs list"
    name               provisioned  space.virtual  created     nfs.enabled  smb.enabled  http.enabled
    test_rest_fs_2     0            0              1517003100  True         False        False
    test_rest_fs_snap  0            0              1517003111  False        False        False
     
    miranda@server$ sshpass -p pureuser ssh pureuser@flashblade001 "purefs list --filter \"nfs.enabled='true'\""
    Name            Size  Used   Created                  Protocols
    test_rest_fs_2  -     0.00   2018-01-26 13:45:00 PST  nfs

Note that some of these options can be used together:

miranda@server$ ssh flasharray001 "purevol list --csv --notitle"
vol1,1073741824,,2018-01-17 15:52:02,4D90F65C11A949A300011012
vol2,209715200,,2018-01-17 15:52:08,4D90F65C11A949A300011013
Simple Format Option Examples

Using what you just learned, you can create some pretty interesting commands. For example, you could compile a list of your FlashBlade flashblade001’s blade names and serial numbers, that could be exported into a spreadsheet:

miranda@server$ sshpass -p pureuser ssh pureuser@flashblade001 "purehw list --type fb --spec --csv" | cut -d ',' -f1,7
Name,Serial
CH1.FB1,PBLUC16140E44
CH1.FB2,PBLUC16140E73
CH1.FB3,PBLUC16140DB9
CH1.FB4,PBLUC16140E66
CH1.FB5,PBLUC16140DF0
CH1.FB6,PBLUC16140E48
CH1.FB7,PBLUC16140DDC
CH1.FB8,PBLUC16140E3A
CH1.FB9,PBLUC16140E15
CH1.FB10,PBLUC160509CA
CH1.FB11,PBLUC16090AB6
CH1.FB12,PBLUC16090B1E
CH1.FB13,PBLUC16090A69
CH1.FB14,PBLUC16090ACD
CH1.FB15,PBLUC160509DB

Or, figure out all IP addresses used by your different Pure arrays:

miranda@server$ for i in flasharray001 flashblade001; do sshpass -p pureuser_pw ssh pureuser@$i "purenetwork list --notitle" | cut -d ',' -f4; done
10.8.102.96
10.8.102.220
10.8.102.21
10.8.102.22
10.8.102.230
10.8.102.231
10.8.102.232
10.8.102.233
10.8.102.234
10.8.102.235

Or finally, discover who destroyed your precious volume “vol1”:

miranda@server$ ssh flasharray001 "puremessage list --audit" | grep -E "ID|vol1"
ID   Time                     User         Command      Subcommand      Name       Arguments
63   2018-01-17 15:52:02 PST  miranda      purevol      create          -          --size 1G vol1
116  2018-01-17 16:48:15 PST  joe_sixpack  purevol      destroy         -          vol1
117  2018-01-17 16:48:20 PST  joe_sixpack  purevol      eradicate       -          vol1

The –cli Option

You might have noticed that I skipped the “–cli” option above. I left the “best for last,” because this option is pretty different from the other format options.

The idea behind “–cli” is that it will output the list of CLI commands that you would need to run to reproduce the current configuration. Another way of thinking about it is that it “teaches” you how to use the CLI by showing you what the CLI commands would look like to get to your current state.

So for the same “purevol list” output that we had above, “purevol list –cli” would show:

miranda@server$ ssh flasharray001 "purevol list --cli"
purevol create --size 1G vol1
purevol create --size 200M vol2
So if I ran these two CLI commands on a blank array, I would end up with two volumes called vol1 and vol2, with the same respective sizes as my other array.

I find this command to be the most useful when editing something like the networking configuration. Let’s say I knew I wanted to mess around with flashblade001’s data vips on vlan 1006:

# Store old configuration into a file called "old_config.sh"
miranda@server$ sshpass -p pureuser_pw ssh pureuser@flashblade001 "purenetwork list --cli --vlan 1006" | tee old_config.sh
purenetwork create vip dv01 --address 10.8.102.96 --servicelist data
purenetwork create vip dv02 --address 10.8.102.97 --servicelist data
purenetwork create vip dv03 --address 10.8.102.98 --servicelist data
 
# Delete these data vips, create some other ones, mess around
 
# Finally, I want to put everything back
miranda@server$ sshpass -p pureuser_pw ssh pureuser@flashblade001 < old_config.sh
Welcome to Iridium
(flashblade001-ch1-fm1  3.13.0-86-generic  #131-Ubuntu SMP Thu May 12 23:33:13 UTC 2016)
Name  Enabled  Subnet  Address      VLAN  Mask           Gateway     MTU   Services
dv01  True     net123  10.8.102.96  1006  255.255.254.0  10.8.102.1  1500  data
Name  Enabled  Subnet  Address      VLAN  Mask           Gateway     MTU   Services
dv02  True     net123  10.8.102.97  1006  255.255.254.0  10.8.102.1  1500  data
Name  Enabled  Subnet  Address      VLAN  Mask           Gateway     MTU   Services
dv03  True     net123  10.8.102.98  1006  255.255.254.0  10.8.102.1  1500  data

The CLI command “pureconfig list” outputs all of the “pure* list –cli” commands for every CLI command in your system. This produces a script that can then be run on another array to get it to the exact same configuration:

miranda@flasharray001> pureconfig list
purevol create --size 1G vol1
purevol create --size 200M vol2
purealert disable flasharray-alerts@purestorage.com
pureadmin global setattr --min-password-length 1
pureadmin setattr --publickey pureuser
purearray rename flasharray001
purearray disable console-lock
purearray setattr --idle-timeout 30
purearray enable phonehome
purearray setattr --proxy http://test.com:1234
...
purecert setattr --self-signed --key-size '2048' --organization 'Pure Storage, Inc.' --organizational-unit 'Pure Storage, Inc.' --days 3650
puresw global disable --auto-download

This is really useful if you want to “clone” one array so that it looks just like another one. You can also pass in specific options to just get “object” configuration, meaning you can have the same volumes and host configuration, without messing with system settings:

miranda@flasharray001> pureconfig list --object
purevol create --size 1G vol1
purevol create --size 2T vol2
purehost create host1
purehost setattr --personality "" host1
purehost setattr --preferred-array "" host1
purehost create host2
purehost setattr --personality "" host2
purehost setattr --preferred-array "" host2
purehost create host3
purehost setattr --personality "" host3
purehost setattr --preferred-array "" host3
purehgroup create --hostlist host1,host2,host3 hg1
purehgroup connect --lun 253 --vol vol2 hg1
purehgroup connect --lun 254 --vol vol1 hg1
purepgroup create --hgrouplist hg1 protection-group1
purepgroup schedule --replicate-frequency 4h --snap-frequency 1h protection-group1
purepgroup retain --per-day 4 --all-for 1d --days 7 --target-per-day 4 --target-all-for 1d --target-days 7 protection-group1

Conclusion

Even though the REST API is our first choice for scripting against your Pure arrays, the CLI has some really useful developer-friendly options. Let me know in the comments what your favorites are… Next time I want to talk more about our scale CLI options “–sort”, “–filter” and “–page”.

Read Full Article
Visit website
  • Show original
  • .
  • Share
  • .
  • Favorite
  • .
  • Email
  • .
  • Add Tags 

There have been a number of customers that have hit an issue with the Test-WindowsBestPractices cmdlet which is part of the PowerShell Toolkit. The problem started to manifest in the November 2017 timeframe when a Cumulative Update (CU) was rolled out across Windows Server 2012, 2012 R2 and 2016. I have confirmed this bug with Microsoft and have an open case with them to keep status on when (and if) a fix will be rolled into the previously mentioned versions of Windows Server.

I have confirmed that this issue is fixed in the latest Insider Preview builds of 17093 or greater. To explain the root of the issue below are two examples of running Get-MPIOSetting on Windows Server 2016 and the other on Windows Server 10.0.17093.

Windows Server 2016

In this example Get-MPIOSetting is output to a variable $mpio. Prior to the issue coming up using this method the $mpio variable was addressable to get/set the individual properties. Using this method after the Windows Server CU was applied shows that the individual properties can no longer be retrieved directly.

Windows Server 10.0.17093

Using the latest version of the Windows Server Insider Preview and applying the same method as explained for the Windows Server 2016 shows that the properties are now properly retrieved.

The impact of this issue in Windows Server 2012, 2012 R2 and 2016 for Pure Storage customers who use the Test-WindowsBestPractices cmdlet is that it simply doesn’t work properly. I have tried a number of methods that I’m not particularly fond of like substring. There I said it. Every line of PowerShell that used ____. Below is the new version that I implemented in the PowerShell Toolkit 1802.22. This checks for Windows Server version and then substrings the results of Get-MPIOSetting. Why do I check what version? Well that’s the other problem. I get different substring results between Windows Server 2012 R2 and 2016. The outcome for now is that customers should use Get-MPIOSetting and Set-MPIOSetting directly and not the Test-WindowsBestPractices cmdlet. Details for how use those cmdlets are outlined in the article Step 02 — Configuring Multipath-IO which is part of the Microsoft Platform Guide. The hope is that a fix will come out for the previous versions of Windows Server I mentioned sooner than later.

<# Get-MPIOSetting Output with Best Practices
PS C:\> Get-MPIOSetting

PathVerificationState     : Disabled
PathVerificationPeriod    : 30
PDORemovePeriod           : 30
RetryCount                : 3
RetryInterval             : 1
UseCustomPathRecoveryTime : Enabled
CustomPathRecoveryTime    : 20
DiskTimeoutValue          : 60
#>

switch ((Get-CimInstance Win32_OperatingSystem).version) {
    6.3.9600 { 
        Write-Host "Windows 2012 R2 -- Current MPIO Settings for $($env:COMPUTERNAME)"
        $MPIO = $null
        $MPIO = Get-MPIOSetting | Out-String 
        $MPIO.Replace(" ","")

        $PathVerificationState = $MPIO.Substring(32,8)
        $PDORemovePeriod = $MPIO.Substring(101,2)
        $UseCustomPathRecoveryTime = $MPIO.Substring(195,8)
        $CustomPathRecoveryTime = $MPIO.Substring(232,2)
        $DiskTimeOutValue = $MPIO.Substring(264,2)

        if($PathVerificationState -eq 'Disabled') {
            Write-Host "FAILED" -ForegroundColor Red -NoNewline
            Write-Host ": PathVerificationState is $($PathVerificationState)."
            $resp = Read-Host "REQUIRED ACTION: Set the PathVerificationState to Enabled?"
		    if ($resp.ToUpper() -eq 'Y') {
                Set-MPIOSetting -NewPathVerificationState Enabled
            } else {
                Write-Host "WARNING: Not changing the PathVerificationState to Enabled could cause unexpected path recovery issues." -ForegroundColor Yellow
            }
        } else {
            Write-Host "PASSED" -ForegroundColor Green -NoNewline
            Write-Host ": PathVerificationState is Enabled. No action required."
        }

        if($PDORemovePeriod -ne '30') {
            Write-Host "FAILED" -ForegroundColor Red -NoNewline
            Write-Host ": PDORemovePeriod is set to $($PDORemovePeriod)."
            $resp = Read-Host "REQUIRED ACTION: Set the PDORemovePeriod to 30?"
		    if ($resp.ToUpper() -eq 'Y') {
                Set-MPIOSetting -NewPDORemovePeriod 30
            } else {
                Write-Host "WARNING: Not changing the PathVerificationState to Enabled could cause unexpected path recovery issues." -ForegroundColor Yellow
            }
        } else {
            Write-Host "PASSED" -ForegroundColor Green -NoNewline
            Write-Host ": PDORemovePeriod is set to 30. No action required."
        }

        if($UseCustomPathRecoveryTime -eq 'Disabled') {
            Write-Host "FAILED" -ForegroundColor Red -NoNewline
            Write-Host ": UseCustomPathRecoveryTime is set to $($UseCustomPathRecoveryTime)."
            $resp = Read-Host "REQUIRED ACTION: Set the UseCustomPathRecoveryTime to Enabled?"
		    if ($resp.ToUpper() -eq 'Y') {
                Set-MPIOSetting -CustomPathRecovery Enabled
            } else {
                Write-Host "WARNING: Not changing the UseCustomPathRecoveryTime to Enabled could cause unexpected path recovery issues." -ForegroundColor Yellow
            }
        } else {
            Write-Host "PASSED" -ForegroundColor Green -NoNewline
            #Write-Host ": UseCustomPathRecoveryTime is set to $($UseCustomPathRecoveryTime). No action required."
            Write-Host ": UseCustomPathRecoveryTime is set to Enabled. No action required."

        }

        if($CustomPathRecoveryTime -ne '20') {
            Write-Host "FAILED" -ForegroundColor Red -NoNewline
            Write-Host ": CustomPathRecoveryTime is set to $($CustomPathRecoveryTime)."
            $resp = Read-Host "REQUIRED ACTION: Set the CustomPathRecoveryTime to 20?"
		    if ($resp.ToUpper() -eq 'Y') {
                Set-MPIOSetting -CustomPathRecovery Enabled
            } else {
                Write-Host "WARNING: Not changing the CustomPathRecoveryTime to 20 could cause unexpected path recovery issues." -ForegroundColor Yellow
            }
        } else {
            Write-Host "PASSED" -ForegroundColor Green -NoNewline
            Write-Host ": CustomPathRecoveryTime is set to $($CustomPathRecoveryTime). No action required."
        }

        if($DiskTimeOutValue -ne '60') {
            Write-Host "FAILED" -ForegroundColor Red -NoNewline
            Write-Host ": DiskTimeOutValue is set to $($DiskTimeOutValue)."
            $resp = Read-Host "REQUIRED ACTION: Set the DiskTimeOutValue to 60?"
		    if ($resp.ToUpper() -eq 'Y') {
                Set-MPIOSetting -NewDiskTimeout 60
            } else {
                Write-Host "WARNING: Not changing the DiskTimeOutValue to 60 could cause unexpected path recovery issues." -ForegroundColor Yellow
            }
        } else {
            Write-Host "PASSED" -ForegroundColor Green -NoNewline
            Write-Host ": DiskTimeOutValue is set to $($DiskTimeOutValue). No action required."
        }
    } # Windows 2012 R2
    10.0.14393 { 
        Write-Host "Windows 2016"
        $MPIO = Get-MPIOSetting | Out-String
        $MPIO.Trim()
        $MPIO.Replace(" ","")

        $PathVerificationState = $MPIO.Substring(32,8)
        $PDORemovePeriod = $MPIO.Substring(102,2)
        $UseCustomPathRecoveryTime = $MPIO.Substring(196,8)
        $CustomPathRecoveryTime = $MPIO.Substring(233,2)
        $DiskTimeOutValue = $MPIO.Substring(265,2)
    
            if($PathVerificationState -eq 'Disabled') {
            Write-Host "FAILED" -ForegroundColor Red -NoNewline
            Write-Host ": PathVerificationState is $($PathVerificationState)."
            $resp = Read-Host "REQUIRED ACTION: Set the PathVerificationState to Enabled?"
		    if ($resp.ToUpper() -eq 'Y') {
                Set-MPIOSetting -NewPathVerificationState Enabled
            } else {
                Write-Host "WARNING: Not changing the PathVerificationState to Enabled could cause unexpected path recovery issues." -ForegroundColor Yellow
            }
        } else {
            Write-Host "PASSED" -ForegroundColor Green -NoNewline
            Write-Host ": PathVerificationState is Enabled. No action required."
        }

        if($PDORemovePeriod -ne '30') {
            Write-Host "FAILED" -ForegroundColor Red -NoNewline
            Write-Host ": PDORemovePeriod is set to $($PDORemovePeriod)."
            $resp = Read-Host "REQUIRED ACTION: Set the PDORemovePeriod to 30?"
		    if ($resp.ToUpper() -eq 'Y') {
                Set-MPIOSetting -NewPDORemovePeriod 30
            } else {
                Write-Host "WARNING: Not changing the PathVerificationState to Enabled could cause unexpected path recovery issues." -ForegroundColor Yellow
            }
        } else {
            Write-Host "PASSED" -ForegroundColor Green -NoNewline
            Write-Host ": PDORemovePeriod is set to 30. No action required."
        }

        if($UseCustomPathRecoveryTime -eq 'Disabled') {
            Write-Host "FAILED" -ForegroundColor Red -NoNewline
            Write-Host ": UseCustomPathRecoveryTime is set to $($UseCustomPathRecoveryTime)."
            $resp = Read-Host "REQUIRED ACTION: Set the UseCustomPathRecoveryTime to Enabled?"
		    if ($resp.ToUpper() -eq 'Y') {
                Set-MPIOSetting -CustomPathRecovery Enabled
            } else {
                Write-Host "WARNING: Not changing the UseCustomPathRecoveryTime to Enabled could cause unexpected path recovery issues." -ForegroundColor Yellow
            }
        } else {
            Write-Host "PASSED" -ForegroundColor Green -NoNewline
            #Write-Host ": UseCustomPathRecoveryTime is set to $($UseCustomPathRecoveryTime). No action required."
            Write-Host ": UseCustomPathRecoveryTime is set to Enabled. No action required."
        }

        if($CustomPathRecoveryTime -ne '20') {
            Write-Host "FAILED" -ForegroundColor Red -NoNewline
            Write-Host ": CustomPathRecoveryTime is set to $($CustomPathRecoveryTime)."
            $resp = Read-Host "REQUIRED ACTION: Set the CustomPathRecoveryTime to 20?"
		    if ($resp.ToUpper() -eq 'Y') {
                Set-MPIOSetting -CustomPathRecovery Enabled
            } else {
                Write-Host "WARNING: Not changing the CustomPathRecoveryTime to 20 could cause unexpected path recovery issues." -ForegroundColor Yellow
            }
        } else {
            Write-Host "PASSED" -ForegroundColor Green -NoNewline
            Write-Host ": CustomPathRecoveryTime is set to $($CustomPathRecoveryTime). No action required."
        }

        if($DiskTimeOutValue -ne '60') {
            Write-Host "FAILED" -ForegroundColor Red -NoNewline
            Write-Host ": DiskTimeOutValue is set to $($DiskTimeOutValue)."
            $resp = Read-Host "REQUIRED ACTION: Set the DiskTimeOutValue to 60?"
		    if ($resp.ToUpper() -eq 'Y') {
                Set-MPIOSetting -NewDiskTimeout 60
            } else {
                Write-Host "WARNING: Not changing the DiskTimeOutValue to 60 could cause unexpected path recovery issues." -ForegroundColor Yellow
            }
        } else {
            Write-Host "PASSED" -ForegroundColor Green -NoNewline
            Write-Host ": DiskTimeOutValue is set to $($DiskTimeOutValue). No action required."
        }
    } # Windows 2016
}

Hope this helps explain why there are issues with the Test-WindowsBestPractices cmdlet. Stay tuned for updates.

Thanks,
Barkz

Read Full Article
Visit website
  • Show original
  • .
  • Share
  • .
  • Favorite
  • .
  • Email
  • .
  • Add Tags 

FlashRecover protection groups can be defined at all the different object levels the FlashArray supports; volumes, hosts and host groups. Whenever a snapshot is created, the individual objects in the protection group are snapped together to create a point-in-time consistency group called a protection group snapshot. FlashRecover protection groups can be defined and managed from the Pure Storage GUI, CLI and Windows PowerShell. Protection groups are required for scheduling snapshots to occur locally or for snapshot to be replicated.

Microsoft SQL Server is a typical candidate for using a protection group as there may be many databases spread across multiple volumes, hosts or host groups. When defining the protection group and local snapshot policy a schedule can be created that includes how often to create a snapshot and length of retention.

Protection group snapshots allow you to recover volumes on the local array, for recovering from corruption or user error, or for creating clones for test & development. Protection group snapshots that are replicated to a target array can be used to recover from a disaster or can be cloned for creating dev/test instances on a secondary array.

One challenge when working with protection group snapshots is that each volume in the protection group must be recovered or cloned in order to recover the whole protection group. I’ve implemented a new cmdlet that allows you to easily recover all the volumes in a protection group snapshot in one single operation.

In this example I’ll use a protection group snapshot replicated from source array cs-perf-pure-02 with 6 members which are all volumes.

For discussion purposes lets suppose that the above schedule has been executing and has created 2 snapshots.

These 2 snapshots each contain a consistency group of the 6 members (volumes).

Restoring each of the members of the snapshot requires that each individual snapshot be copied to a new volume that can then be attached to a host or host group.

If we think about this situation and relate it to a disaster recovery scenario every second of downtime is crucial and this process would need further automation to support the business requirements. Thinking back to the example scenario of using Microsoft SQL Server we know that we are dealing with a Windows Server environment. With Windows we can take advantage of Pure Storage PowerShell Toolkit to automate this process and recover all of the volumes from this protection group snapshot in one operation.

function Restore-PfaProtectionGroupVolumeSnapshots()
{
	[CmdletBinding()]
	Param (
		[Parameter(Mandatory = $True)][ValidateNotNullOrEmpty()][string] $FlashArray,
		[Parameter(Mandatory = $True)][ValidateNotNullOrEmpty()][string] $ProtectionGroup,
		[Parameter(Mandatory = $True)][ValidateNotNullOrEmpty()][string] $SnapshotName,
		[Parameter(Mandatory = $True)][ValidateNotNullOrEmpty()][string] $Prefix,
		[Parameter(Mandatory = $False)][ValidateNotNullOrEmpty()][string] $Hostname,
		[Parameter(Mandatory = $True)][ValidateNotNullOrEmpty()][Microsoft.PowerShell.Commands.WebRequestSession]$Session

	)

    $PGroupVolumes = Get-PfaProtectionGroup -FlashArray $FlashArray -Name $ProtectionGroup -Session $Session
    $PGroupSnapshotsSet = $SnapshotName

    ForEach ($PGroupVolume in $PGroupVolumes)
    {
        For($i=0;$i -lt $PGroupVolume.volumes.Count;$i++)
        {
            $NewPGSnapshotVol = ($PGroupVolume.volumes[$i]).Replace($PGroupVolume.source+":",$Prefix+"-")
            $Source = ($PGroupSnapshotsSet+"."+$PGroupVolumes.volumes[$i]).Replace($PGroupVolume.source+":","")
            New-PfaVolume -FlashArray $FlashArray -Name $NewPGSnapshotVol -Source $Source -Session $Session
            Connect-PfaVolume -FlashArray $FlashArray -Name $Hostname -Volume $NewPGSnapshotVol -Session $Session
        }
    }
}

Restore-PfaProtectionGroupVolumeSnapshots –FlashArray pure01.example.com `
    –ProtectionGroup "CS-PERF-PURE-02:LT" `
    –SnapshotName "CS-PERF-PURE-02:LT.2" `
    –Prefix TEST `
    -Hostname TMEHOST1 `
    –Session $FASession

Note: An important point to note about the above PowerShell is that the calling cmdlet at the bottom of the example script assumes that there is an established Session created (eg. $FASession).

I implemented by creating the Restore-PfaProtectionGroupVolumeSnapshots function which uses other toolkit cmdlets (Get-PfaProtectionGroup and New-PfaVolume). After running the function with the parameters ProtectionGroup, VolumeSnapshots, Prefix and Session each of the individual volume snapshots have been restored.

This new function is now part of the updated release of the Pure Storage PowerShell Toolkit v2.2.1.302. The toolkit can be downloaded from https://github.com/purestorage-openconnect/powershell-toolkit.

If you want this feature ping me @barkz on twitter.

Thanks,
Barkz

Read Full Article
Visit website
  • Show original
  • .
  • Share
  • .
  • Favorite
  • .
  • Email
  • .
  • Add Tags 

I had a question asked about how to determine whether or not a connected volume to a Windows Server host is thin provisioned or not. I put together the below PowerShell script to do the following:

  • Retrieve the locally connected volumes. Since this is using Get-WMIObject this is usable across all versions of Windows Server supported by Pure Storage.
  • Connect to the FlashArray and retrieve volumes.
  • Compare the UniqueId of the locally connected volumes to the FlashArray volume serial numbers.
  • Return the volume name which has the correlated serial number.

PowerShell:

# Get connected volumes to host
$UniqueIds = Get-WMIObject -Class MSFT_Disk -Namespace 'ROOT\Microsoft\Windows\Storage' | Select-Object ProvisioningType,UniqueId,Number

# Connect to FlashArray
$FlashArray = New-PfaArray -EndPoint 10.21.201.57 -Credentials (Get-Credential) -IgnoreCertificateError

# Retrieved Volumes
$Volumes = Get-PfaVolumes -Array $FlashArray | Select-Object Name,Serial

# Inspect Volumes and compare to UniqueId
ForEach ($UniqueId in $UniqueIds) {
    ForEach ($Volume in $Volumes) {
        If (($UniqueId.UniqueId).Substring($UniqueId.UniqueId.Length-24) -eq $Volume.Serial) {
            Write-Host "Volume: $($Volume.Name)"
            Write-Host "Serial: $($Volume.serial)"
            Switch ($UniqueId.ProvisioningType) {
                0 { Write-Host "Type: Unknown" }
                1 { Write-Host "Type: Thin" }
                2 { Write-Host "Type: Fixed" }
            }
        }
    }
}

Example Output:

PS C:\Users\Administrator.MSLAB\Desktop> .\Get-PfaVolumeType.ps1

cmdlet Get-Credential at command pipeline position 1
Supply values for the following parameters:
Credential

Volume: Server02-Data01
Serial: 45084F3508BF461400011CF9
Type: Thin

I will be adding this as a cmdlet to the PowerShell Toolkit.

Thanks,
Barkz

Read Full Article
Visit website
  • Show original
  • .
  • Share
  • .
  • Favorite
  • .
  • Email
  • .
  • Add Tags 

In August 2017 we announced the release of our >Hybrid Cloud with AWS and the demonstration in this blog is a follow-up to show how to leverage FlashRecover Snapshots with Microsoft SQL Server to make copies and present to an AWS EC2 virtual machine. Connecting on-premises storage to AWS can be challenging whether coming from your own data center or at a co-location facility provides Cloud Exchange services. We not only help ease the connectivity using our scripts for the Hybrid Cloud with AWS solution but also using the simplicity of Pure Storage create snapshots, new volumes, connect to hosts and expand (or shrink) volumes.

Below is a high-level overview of what is going on between the FlashArray//M20 and the AWS EC2 virtual machine. While reviewing the diagram know that the Hybrid Cloud with AWS solution scripts making the iSCSI, AWS Direct Connect, switches and FlashArray configuration a ton easier. We simplify the “first mile” of connectivity when co-locating equipment and connecting to AWS.

Creating SQL Server Database Copies with AWS DirectConnect and AWS EC2 - YouTube

Thanks,
Barkz

Read Full Article
Visit website
  • Show original
  • .
  • Share
  • .
  • Favorite
  • .
  • Email
  • .
  • Add Tags 

There are no words for my appreciation to Chappy, Kyle, Charlies, Jon, Daniel, Arthur, John, Joe and a host of others for creating this song.

The_PowerShell_Scripting_Song - YouTube

Enjoy the sounds of PowerShell goodness.

Cheers,
Barkz

Read Full Article
Visit website
  • Show original
  • .
  • Share
  • .
  • Favorite
  • .
  • Email
  • .
  • Add Tags 

In Part 1 of creating volumes from Protection Group (PGroup) sources I discussed how to get a specific snapshot to use for a disaster recovery (DR) restore. In the case of having a more automated DR workflow retrieving the latest snapshot from the PGroup is a key requirement.

The below PowerShell script example removes the manual task of picking a specific PGroup snapshot like in Part 1.

# Connect to FlashArray.
$f = New-PfaArray -EndPoint 10.0.0.1 -Credentials (Get-Credential) -IgnoreCertificateError

# Get latest PGroup Snapshots.
$psoPGroup = Get-PfaAllVolumeSnapshots -Array $f | where {$_.Source -like "*Barkz-Bootlun-06-WS2016-DC-GUI-6*" -and $_.Name -like "*z-nightly-replica-to-PureTEC*"}
ForEach ($PGroupSnapshot in $psoPGroup) {
  If ([DateTime]($PGroupSnapshot.created) -gt (get-date).addHours(-8)) {
     Write-Host $PGroupSnapshot.name " -- " $PGroupSnapshot.created
  }
}

Note: You will notice that the Get-PfaAllVolumeSnapshots does not return a PSObject and the “created” field is returned as a string. Using [DateTime] I convert the string to a datetime and then compare that to get snapshots >8hrs.

Output:

z-nightly-replica-to-PureTEC.158.Barkz-Bootlun-06-WS2016-DC-GUI-6 -- 2017-10-20T15:49:00Z
z-nightly-replica-to-PureTEC.159.Barkz-Bootlun-06-WS2016-DC-GUI-6 -- 2017-10-20T17:39:00Z

Thanks,
Barkz

Read Full Article
Visit website

Read for later

Articles marked as Favorite are saved for later viewing.
close
  • Show original
  • .
  • Share
  • .
  • Favorite
  • .
  • Email
  • .
  • Add Tags 

Separate tags by commas
To access this feature, please upgrade your account.
Start your free month
Free Preview