{"id":831,"date":"2010-06-09T09:23:59","date_gmt":"2010-06-09T14:23:59","guid":{"rendered":"http:\/\/www.jasemccarty.com\/blog\/?p=831"},"modified":"2010-06-09T09:23:59","modified_gmt":"2010-06-09T14:23:59","slug":"using-the-data-ontap-powershell-toolkit-to-add-vsphere-storage","status":"publish","type":"post","link":"https:\/\/www.jasemccarty.com\/blog\/using-the-data-ontap-powershell-toolkit-to-add-vsphere-storage\/","title":{"rendered":"Using the Data ONTAP PowerShell Toolkit to add vSphere Storage"},"content":{"rendered":"<p>Over the past year or so, I have started using PowerShell more and more.<\/p>\n<p>I was really exited to see the release of the NetApp <strong><a title=\"Data ONTAP PowerShell Toolkit 1.0\" href=\"http:\/\/communities.netapp.com\/community\/interfaces_and_tools\/data_ontap_powershell_toolkit\" target=\"_blank\">Data ONTAP PowerShell Toolkit 1.0<\/a><\/strong>. I say this, because I have been using the &#8220;unsupported&#8221; <strong><a title=\"PoshOnTap\" href=\"http:\/\/poshontap.codeplex.com\/\" target=\"_blank\">PoshOnTap<\/a><\/strong> PowerShell extensions for some NetApp management. I have to give credit where credit is due, and <strong><a title=\"Get-Admin.com\" href=\"http:\/\/www.get-admin.com\/\" target=\"_blank\">Glenn Sizemore<\/a><\/strong> has done a great job with PoshOnTap.<\/p>\n<p>PowerShell is really powerful, and because more and more vendors are providing more and more modules for the management of different aspects of the enterprise. With one script, I can create a NetApp volume, export it as an NFS export, and then connect it to all of my VMware vSphere hosts.<\/p>\n<p><em>Note: This script is meant to be run from the vSphere PowerCLI.<\/em><\/p>\n<pre class=\"brush: powershell; title: ; notranslate\" title=\"\">\n##########################################################\n# Create-And-Add-Storage-example.ps1\n# Jase McCarty 6\/7\/2010\n# Posh Script to add a volume on a NetApp Filer\n# and present it to all vSphere hosts\n##########################################################\n\n# Add the vSphere PowerCLI SnapIn and the DATA ONTAP Module\nImport-module DataONTAP\n\n# Set my variables\n$vCenter = vcenter.jasemccarty.com\n$Filer = netapp1.jasemccarty.com\n$aggr = aggr1\n$newvol = volx\n\n# Connect to vCenter and our NetApp Filer\nConnect-VIServer $vCenter\nConnect-NaController $Filer\n\n# Create a new volume\nNew-NaVol $newvol $aggr 500g\n\n# Set some options for the new volume\nSet-NaVolOption $newvol no_atime_update yes\nSet-NaVolOption $newvol fractional_reserve 0\n\n# Set the SnapShot Reserve to 0\nSet-NaSnapshotreserve\u00a0 $newvol 0\nSet-NaSnapshotschedule $newvol -Weeks 0 -Days 0 -Hours 0\n\n# Add an NFS export\nAdd-NaNfsExport \/vol\/$newvol -Persistent -ReadWrite all-hosts -NoSuid -SecurityFlavors sys,krb5\n\n# Get all the vSphere Hosts and add the NFS export\n$Hosts = Get-VMHost\nForEach ($H in $Hosts)\n{\n New-Datastore -Nfs -VMHost $_.Name -NAME $newvol -Path \/vol\/$newvol -NfsHost $Filer;\n}\n\n<\/pre>\n<p><em>**Note, this is a pretty incomplete script.\u00a0 Security for the export will have to be addressed, and the Filer management IP (netapp1.jasemccarty.com) is probably not the same as the IP used for the NFS export.\u00a0 This is just an example of how this can be used.<\/em><\/p>\n<p>Pretty cool.\u00a0 I can only imagine the <em>Posh<\/em>ibilities.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Over the past year or so, I have started using PowerShell more and more. I was really exited to see the release of the NetApp &hellip; <\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[12],"tags":[56,58,66,87,105,111],"class_list":["post-831","post","type-post","status-publish","format-standard","hentry","category-virtualization","tag-netapp","tag-nfs","tag-powershell","tag-storage","tag-vmware","tag-vsphere"],"_links":{"self":[{"href":"https:\/\/www.jasemccarty.com\/blog\/wp-json\/wp\/v2\/posts\/831","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.jasemccarty.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.jasemccarty.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.jasemccarty.com\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.jasemccarty.com\/blog\/wp-json\/wp\/v2\/comments?post=831"}],"version-history":[{"count":0,"href":"https:\/\/www.jasemccarty.com\/blog\/wp-json\/wp\/v2\/posts\/831\/revisions"}],"wp:attachment":[{"href":"https:\/\/www.jasemccarty.com\/blog\/wp-json\/wp\/v2\/media?parent=831"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.jasemccarty.com\/blog\/wp-json\/wp\/v2\/categories?post=831"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.jasemccarty.com\/blog\/wp-json\/wp\/v2\/tags?post=831"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}