# # Name: Acquire WFA OCUM6X Data Source # Version: 1.0.0 # From: NetApp Inc. # Min WFA version needed: WFA2.2 # Copyright (C) 2015 NetApp, Inc. All rights reserved. # # Email: sinhaa@netapp.com param ( [parameter(Mandatory=$true, HelpMessage="OCUM server IP or Name")] [string]$OCUMServer ) if ($PSVersionTable.PSVersion.Major -le '2') { throw("Minimun PowerShell version required is 3.0") } #Get the data sources informations for this wfa server and filter them on the OCUM info $REGISTRY = "HKLM:\SOFTWARE\Wow6432Node\Apache Software Foundation\Procrun 2.0\NA_WFA_SRV\Parameters\Java" $httpPort = (Get-ItemProperty $REGISTRY | select -ExpandProperty Options | where {$_ -match "-Dhttp.port"}).split("=")[1] [System.Net.ServicePointManager]::ServerCertificateValidationCallback = {$true} $url1 = "http://localhost:$httpPort/rest/data_sources" $cd = Get-WfaCredentials -Host "localhost" if(!$cd) { throw ("Credentials for localhost not found") } Get-WFALogger -Info -message $("Calling REST with uri: "+ $url1) $DSList = Invoke-RestMethod -Method get -Uri $url1 -Credential $cd -TimeoutSec 300 foreach($DS in $DSList.collection.dataSource) { if( ($DS.ip -eq $OCUMServer) -AND ($DS.schema -eq "cm_storage") -AND ($DS.interval -gt 0) -AND ($DS.type -match "OnCommand Unified Manager (.*)") ) { $DSName = $DS.name $url2 = "http://localhost:$httpPort/rest/data_sources/$DSName/cm_storage/jobs" } } Get-WFALogger -Info -message $("Calling REST with uri: "+ $url2) $dsResult = Invoke-RestMethod -Uri $url2 -Method Post -Credential $cd -ContentType "application/xml" $jobId = $dsResult.acquisitionJob.jobId Get-WFALogger -Info -message $("Job ID: "+ $jobId) $url3 = $url2 + "/$jobId" Get-WFALogger -Info -message $url3 Add-WfaWorkflowParameter -Name jobUrl -Value $url3