Version 6

    I don't know about yourselves, but we suffer with volumes reporting as down and Orion not picking up on their new instances automatically.

    We think this is down to VM migrations or just configuration changes.


    I used to go through a process of using SQL to find the dead volumes, then going to Node Manager, removing the down volumes and then running List Resources against the node to pick up on the new drive instances. This was a long winded and slow process, with an average of 140 down volumes found every week.

    So I thought to myself, this needs some automation!




    1. Find the down Volumes with a bit of SWQL

    2. Remove these volumes using the API

    3. Create URLs for each NodeID (found with down volumes) to open the 'List Resources' in a internet browser, with auto-refresh, so that you can manually select the volumes.

        As you can't do this via the API yet.


    So here's a PowerShell script, that hopefully you can use to assist you.

    Relies on having Chrome installed, to change from chrome.exe, delete the Stat-Process chrome.exe line and un-comment the iexplorer.exe line underneath.

    The SELECT statement is limited to the first 10 down volumes, this limits the script to opening 10 List Resources at a time. You may want to increase or decrease this number.


    Please ensure that you test this, somewhere safe, as I wouldn't want you to break anything.



    # Description: SWIS PowerShell to find , then delete and then open the List Resources for that Node, so we can reselect the hard drives manually.

    # Author: Richard Graham

    # Date: 2019/02/06

    # Notes: How-To make an encypted password file -


    #Load SwisSnapin if required

    if ( (Get-PSSnapin -Name SwisSnapin -ErrorAction SilentlyContinue) -eq $null )

          { Add-PSSnapin SwisSnapin }


    #Alter these variables to suit your environment

    $server = '<FQDN of Orion>'                                                # Your Orion server

    $user ='SWISuser'                                                                # Orion username

    $file = 'C:\Users\admin\encrypted-password.bin'                  # Orion user encrypted password file, see Notes for URL on how-to

    $outfile = 'C:\Users\admin\resource_links.txt'                


    #URL link

    $resourcelink = 'http://' + $server + '/Orion/Nodes/ListResources.aspx?Nodes='


    If ([System.IO.File]::Exists($outfile))

      { Remove-Item $outfile }


    #Read encrypted file into $credential - see Notes for URL on how-to

    $password = Get-Content $file | ConvertTo-SecureString

    $creds = New-Object System.Management.Automation.PsCredential($user,$password)


    #SWIS connection string

    $swis = Connect-Swis -host $server -Credential $creds


    #Get the down volume details

    $results = Get-SwisData $swis "TOP 10 SELECT Uri, FullName, NodeID, VolumeID FROM Orion.Volumes WHERE Status = 2"

    #$results = Get-SwisData $swis "SELECT Uri, FullName, NodeID, VolumeID FROM Orion.Volumes WHERE Status = 2"


    #If no down Volumes then exit

    Write-Host "There were" $results.Count "volumes reporting as down"

    If ($result -eq $null) {exit(0)}


    #Remove dead volumes and create resource URL file

    ForEach ($result IN $results)


              #Write-Host $result.FullName "(NodeID :" $result.NodeID "VolumeID :" $result.VolumeID ") is down"


              #Delete Down VolumeIDs

              Write-Host "Deleting VolumeID:" $result.FullName

              Remove-SwisObject $swis -Uri $result.Uri


              #List resources for $result.NodeID adding all disk volumes (not memory, swap, etc)

              #This function is not yet available via the API, so we'll output URLs to file

              $link = $resourcelink + $result.NodeID + '&ForceRefresh=true'

              Out-File -Append -FilePath $outfile -InputObject $link



    #Sort $outfile to be unique URLs

    $unique = Get-Content $outfile | Sort | Get-Unique

    Out-File -FilePath $outfile -InputObject $unique


    #And then open Chrome tabs for each List Resources URL (make sure you are logged into Orion web GUI first)

    $urls = Get-Content $outfile

    ForEach ($url in $urls)

            { Start-Process "chrome.exe" $url

              #Start-Process 'C:\Program Files (x86)\Internet Explorer\iexplore.exe' $url