Here is a simple but powerfull POSH script for VISIO your C-Mode config.
You need the have the latest release of PowerShell 1.7 and MS Office VISIO 2010.
#Copyright: Marc Hofstetter / NetApp / 2012 / version 0.75
#POWERSHELL SCRIPT VISIO YOUR C-MODE CONFIG
#Import Data ONTAP PowerShell Toolkit
Import-Module DataONTAP
#VISIO SHAPES for DRAWING
$shpFile1 = "\NetApp-Logic-Icons.vss"
$shpFile2 = "\NetApp-Equipment-Icons.vss"
$shpFile3 = "\NetApp-Icons-2.vss"
$shpFile4 = "\NetApp-Essentials.vss"
#VISIO Function for the Connection-of-objects
function connect-visioobject ($firstObj, $secondObj)
{
$shpConn = $pagObj.Drop($pagObj.Application.ConnectorToolDataObject, 0, 0)
#// Connect its Begin to the 'From' shape:
$connectBegin = $shpConn.CellsU("BeginX").GlueTo($firstObj.CellsU("PinX"))
#// Connect its End to the 'To' shape:
$connectEnd = $shpConn.CellsU("EndX").GlueTo($secondObj.CellsU("PinX"))
}
#VISIO Function for adding the object into the drawing
function add-visioobject ($mastObj, $item)
{
Write-Host "Adding $item"
# Drop the selected stencil on the active page, with the coordinates x, y
$shpObj = $pagObj.Drop($mastObj, $x, $y)
# Enter text for the object
$shpObj.Text = $item
#Return the visioobject to be used
return $shpObj
}
# Create an instance of Visio and create a document based on the Basic Diagram template.
$AppVisio = New-Object -ComObject Visio.Application
$docsObj = $AppVisio.Documents
$DocObj = $docsObj.Add("Basic Network Diagram.vst")
# Set the active page of the document to page 1
$pagsObj = $AppVisio.ActiveDocument.Pages
$pagObj = $pagsObj.Item(1)
# Load a set of stencils and select one to drop
$stnPath = [system.Environment]::GetFolderPath('MyDocuments') + "\My Shapes\NetApp\"
$stnObj1 = $AppVisio.Documents.Add($stnPath + $shpFile1)
$FlexVOLObj = $stnObj1.Masters.Item("FlexVol")
$AggrObj = $stnObj1.Masters.Item("Raid Grp Aggregate Storage")
$LUNObj = $stnObj1.Masters.Item("Cylinder")
#Define FAS-Controller Object
$stnObj2 = $AppVisio.Documents.Add($stnPath + $shpFile2)
$FASObj = $stnObj2.Masters.Item("FAS3000")
#Define VServer Object
$stnObj2 = $AppVisio.Documents.Add($stnPath + $shpFile3)
$VServerObj = $stnObj2.Masters.Item("WorkGroup Servers")
#Defien NetApp Frame Obejct
$stnObj4 = $AppVisio.Documents.Add($stnPath + $shpFile4)
$FrameObject = $stnObj4.Masters.Item("Small Title min margin")
$FrameObj = add-visioobject $FrameObject $nodeInfo
#Get Host Name to Connect to
$FASName = read-host "Enter the FQDN of your NetApp C-MODE Cluster"
If ($FASName -eq "") { Write-Host "No selection made, script now exiting." ; exit }
$USERName = read-host "Enter the username for accessing the C-MODE Cluster"
If ($USERName -eq "") { Write-Host "No input made, script now exiting." ; exit }
#HERE WE GO - GET ALL STORAGE DETAILS - using MHOFSTET CRED
Connect-NcController -Name $FASName -Credential $USERName
$allNODES = Get-NcNode
$allVServers = Get-NcVserver
$allAGGR = Get-NcAggr
$allVOLS = Get-NcVol
#Set Start Locations of Objects
$x = 1
$y = 1
#DRAW ALL PHYSICAL-NODES
Foreach ($node in $allNodes) {
$y += 1
$nodeInfo = "NODE: " + $node
$nodeObj = add-visioobject $FASObj $nodeInfo
#DRAW ALL AGGR for physical NODES
Foreach ($aggr in $allAGGR) {
If ($aggr.Nodes -eq $node) {
$x = 2
$y += 1.5
$aggrInfo = "AGGREGATE: " + $aggr.Name
$aggrObj = add-visioobject $AggrObj $aggrInfo
connect-visioobject $nodeObj $aggrObj
}
# GET ROOT VOL for NODE
$allVOLS2 = Get-NcVol -Vserver $node
foreach ($vol in $allVols2) {
if ($vol.Vserver -eq $aggr.AggrOwnershipAttributes.HomeName -and $vol.VolumeIdAttributes.ContainingAggregateName -eq $aggr.Name){
$x += 1
$volInfo = "VOLUME: " + $vol.Name
$FlexVOLObj = add-visioobject $FlexVOLObj $volInfo
connect-visioobject $aggrObj $FlexVOLObj
}
}
# GET DATA VOL for VSERVER
$allVOLS3 = Get-NcVol -Aggregate $aggr | where {$_.Name -ne "vol0"}
foreach ($vol in $allVols3) {
if ($vol.VolumeIdAttributes.ContainingAggregateName -eq $aggr.AggregateName -and $aggr.AggrOwnershipAttributes.HomeName -eq $node.Node){
$x += 1
$volInfo = "VOLUME: " + $vol.Name
$FlexVOLObj = add-visioobject $FlexVOLObj $volInfo
connect-visioobject $aggrObj $FlexVOLObj
}
$x2 = $x
}
}
$x = 1
$y += 1
}
$x = $x2
Foreach ($vserver in $allVServers) {
if ($vserver.VserverType -eq "cluster"){
$vserverInfo = "VSERVER Name: " + $vserver
$vserverObj = add-visioobject $VServerObj $vserverInfo
$x += 1.5
#connect-visioobject $FlexVOLObj $vserverObj
}
}
# Resize to fit page
$pagObj.ResizeToFitContents()
# END Script