{"id":3990,"date":"2018-10-11T16:57:51","date_gmt":"2018-10-11T21:57:51","guid":{"rendered":"http:\/\/www.jasemccarty.com\/blog\/?p=3990"},"modified":"2020-02-16T16:58:13","modified_gmt":"2020-02-16T22:58:13","slug":"more-vsan-cmdlets-in-powercli-11","status":"publish","type":"post","link":"https:\/\/www.jasemccarty.com\/blog\/more-vsan-cmdlets-in-powercli-11\/","title":{"rendered":"More vSAN Cmdlets in PowerCLI 11!"},"content":{"rendered":"<p>There&#8217;s a new release of PowerCLI, and it includes some more vSAN goodness!<a href=\"http:\/\/blogs.vmware.com\/virtualblocks\/files\/2018\/10\/PowerCLI-11-1.png\"><br \/>\n<\/a><\/p>\n<p>We&#8217;ve added some capabilities previously found in the Ruby vSphere Console and have also updated a couple of the existing modules<\/p>\n<p><a href=\"http:\/\/blogs.vmware.com\/virtualblocks\/files\/2018\/10\/PowerCLI-11-1.png\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter wp-image-13918 size-full\" src=\"http:\/\/blogs.vmware.com\/virtualblocks\/files\/2018\/10\/PowerCLI-11-1.png\" alt=\"PowerCLI 11\" width=\"729\" height=\"603\" srcset=\"https:\/\/blogs.vmware.com\/virtualblocks\/files\/2018\/10\/PowerCLI-11-1.png 729w, https:\/\/blogs.vmware.com\/virtualblocks\/files\/2018\/10\/PowerCLI-11-1-206x170.png 206w, https:\/\/blogs.vmware.com\/virtualblocks\/files\/2018\/10\/PowerCLI-11-1-230x190.png 230w\" sizes=\"auto, (max-width: 729px) 100vw, 729px\" \/><\/a><\/p>\n<p>&nbsp;<\/p>\n<p>The new and updated cmdlets include:<\/p>\n<ul>\n<li><strong>Get-VsanObject<\/strong> makes it easy to get information about a vSAN Object or a VM&#8217;s vSAN Objects. This cmdlet returns much of the same information as the <em>vsan.vm_object_info<\/em> and <em>vsan.obj_status_report<\/em> scripts in the RVC. Objects can be returned based on the VM they belong to, the type of vSAN Object, which vSAN Disk they reside on, the cluster\/server they reside on, or their specific Id.<br \/>\n<a href=\"http:\/\/blogs.vmware.com\/virtualblocks\/files\/2018\/10\/PowerCLI-11-2.png\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter wp-image-13913 size-full\" src=\"http:\/\/blogs.vmware.com\/virtualblocks\/files\/2018\/10\/PowerCLI-11-2.png\" alt=\"PowerCLI 11\" width=\"742\" height=\"743\" srcset=\"https:\/\/blogs.vmware.com\/virtualblocks\/files\/2018\/10\/PowerCLI-11-2.png 742w, https:\/\/blogs.vmware.com\/virtualblocks\/files\/2018\/10\/PowerCLI-11-2-85x85.png 85w, https:\/\/blogs.vmware.com\/virtualblocks\/files\/2018\/10\/PowerCLI-11-2-170x170.png 170w, https:\/\/blogs.vmware.com\/virtualblocks\/files\/2018\/10\/PowerCLI-11-2-190x190.png 190w, https:\/\/blogs.vmware.com\/virtualblocks\/files\/2018\/10\/PowerCLI-11-2-125x125.png 125w\" sizes=\"auto, (max-width: 742px) 100vw, 742px\" \/><\/a><\/li>\n<li><strong>Get-VsanComponent<\/strong> returns information about the different components that make up a vSAN Object. The vsan.disk_object_info script returns this information but only returns components on a specific vSAN Disk. This cmdlet can enumerate components based on their Id, per host, or specific vSAN Disk it resides on.<br \/>\n<a href=\"http:\/\/blogs.vmware.com\/virtualblocks\/files\/2018\/10\/PowerCLI-11-3.png\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter wp-image-13915 size-full\" src=\"http:\/\/blogs.vmware.com\/virtualblocks\/files\/2018\/10\/PowerCLI-11-3.png\" alt=\"PowerCLI 11\" width=\"742\" height=\"743\" srcset=\"https:\/\/blogs.vmware.com\/virtualblocks\/files\/2018\/10\/PowerCLI-11-3.png 742w, https:\/\/blogs.vmware.com\/virtualblocks\/files\/2018\/10\/PowerCLI-11-3-85x85.png 85w, https:\/\/blogs.vmware.com\/virtualblocks\/files\/2018\/10\/PowerCLI-11-3-170x170.png 170w, https:\/\/blogs.vmware.com\/virtualblocks\/files\/2018\/10\/PowerCLI-11-3-190x190.png 190w, https:\/\/blogs.vmware.com\/virtualblocks\/files\/2018\/10\/PowerCLI-11-3-125x125.png 125w\" sizes=\"auto, (max-width: 742px) 100vw, 742px\" \/><\/a><\/li>\n<li><strong>Get-VsanEvacuationPlan<\/strong>  provides visibility of the impact of a host, disk group, or device were to be put into maintenance mode or were to go offline. This also shows how much data has to move to maintain storage policy compliance, or to ensure accessibility to one or more vSAN Objects.<br \/>\n<a href=\"http:\/\/blogs.vmware.com\/virtualblocks\/files\/2018\/10\/PowerCLI-11-4.png\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter wp-image-13917 size-full\" src=\"http:\/\/blogs.vmware.com\/virtualblocks\/files\/2018\/10\/PowerCLI-11-4.png\" alt=\"PowerCLI 11\" width=\"742\" height=\"757\" srcset=\"https:\/\/blogs.vmware.com\/virtualblocks\/files\/2018\/10\/PowerCLI-11-4.png 742w, https:\/\/blogs.vmware.com\/virtualblocks\/files\/2018\/10\/PowerCLI-11-4-167x170.png 167w, https:\/\/blogs.vmware.com\/virtualblocks\/files\/2018\/10\/PowerCLI-11-4-186x190.png 186w\" sizes=\"auto, (max-width: 742px) 100vw, 742px\" \/><\/a><\/li>\n<li><strong>Get-VsanDisk<\/strong> was introduced in an earlier release of PowerCLI, additional properties including Capacity and Percent of Capacity Used.<br \/>\n<a href=\"http:\/\/blogs.vmware.com\/virtualblocks\/files\/2018\/10\/PowerCLI-11-5.png\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter wp-image-13919 size-full\" src=\"http:\/\/blogs.vmware.com\/virtualblocks\/files\/2018\/10\/PowerCLI-11-5.png\" alt=\"PowerCLI 11\" width=\"742\" height=\"589\" srcset=\"https:\/\/blogs.vmware.com\/virtualblocks\/files\/2018\/10\/PowerCLI-11-5.png 742w, https:\/\/blogs.vmware.com\/virtualblocks\/files\/2018\/10\/PowerCLI-11-5-214x170.png 214w, https:\/\/blogs.vmware.com\/virtualblocks\/files\/2018\/10\/PowerCLI-11-5-239x190.png 239w\" sizes=\"auto, (max-width: 742px) 100vw, 742px\" \/><\/a><\/li>\n<li><strong>Get-VsanStat<\/strong> has been enhanced to allow for predetermined time range as well as a time range that is longer than 24 hours. Predetermined time ranges include Last5Minutes, Last15Minutes, LastHour, and more.<br \/>\n<a href=\"http:\/\/blogs.vmware.com\/virtualblocks\/files\/2018\/10\/PowerCLI-11-6.png\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter wp-image-13920 size-full\" src=\"http:\/\/blogs.vmware.com\/virtualblocks\/files\/2018\/10\/PowerCLI-11-6.png\" alt=\"PowerCLI 11\" width=\"742\" height=\"463\" srcset=\"https:\/\/blogs.vmware.com\/virtualblocks\/files\/2018\/10\/PowerCLI-11-6.png 742w, https:\/\/blogs.vmware.com\/virtualblocks\/files\/2018\/10\/PowerCLI-11-6-220x137.png 220w, https:\/\/blogs.vmware.com\/virtualblocks\/files\/2018\/10\/PowerCLI-11-6-290x181.png 290w\" sizes=\"auto, (max-width: 742px) 100vw, 742px\" \/><\/a><\/li>\n<\/ul>\n<p>&nbsp;<\/p>\n<p>Administrators who have previously looked for vSAN information in the RVC, now have much of the same information at their fingertips using PowerCLI. More detailed vSAN information can be retrieved programmatically with PowerCLI, which can be used for management, orchestration, and other related tasks.<\/p>\n<p>While the PowerCLI cmdlets don&#8217;t necessarily provide the same output as some of the RVC scripts, it is entirely possible to report in a similar fashion. Here is a sample output of the <em>vsan.vm_object_info<\/em> RVC script for a the RDC1 VM:<\/p>\n<p><a href=\"http:\/\/blogs.vmware.com\/virtualblocks\/files\/2018\/10\/PowerCLI-11-7-RVC.png\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter wp-image-13922 size-full\" src=\"http:\/\/blogs.vmware.com\/virtualblocks\/files\/2018\/10\/PowerCLI-11-7-RVC.png\" alt=\"PowerCLI 11\" width=\"752\" height=\"701\" srcset=\"https:\/\/blogs.vmware.com\/virtualblocks\/files\/2018\/10\/PowerCLI-11-7-RVC.png 752w, https:\/\/blogs.vmware.com\/virtualblocks\/files\/2018\/10\/PowerCLI-11-7-RVC-182x170.png 182w, https:\/\/blogs.vmware.com\/virtualblocks\/files\/2018\/10\/PowerCLI-11-7-RVC-204x190.png 204w\" sizes=\"auto, (max-width: 752px) 100vw, 752px\" \/><\/a><\/p>\n<p>Creating a PowerShell Function, the same can be accomplished easily:<\/p>\n<p><a href=\"http:\/\/blogs.vmware.com\/virtualblocks\/files\/2018\/10\/PowerCLI-11-8-PSM1.png\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter wp-image-13923 size-large\" src=\"http:\/\/blogs.vmware.com\/virtualblocks\/files\/2018\/10\/PowerCLI-11-8-PSM1-1024x865.png\" alt=\"PowerCLI 11\" width=\"580\" height=\"490\" srcset=\"https:\/\/blogs.vmware.com\/virtualblocks\/files\/2018\/10\/PowerCLI-11-8-PSM1-1024x865.png 1024w, https:\/\/blogs.vmware.com\/virtualblocks\/files\/2018\/10\/PowerCLI-11-8-PSM1-201x170.png 201w, https:\/\/blogs.vmware.com\/virtualblocks\/files\/2018\/10\/PowerCLI-11-8-PSM1-768x649.png 768w, https:\/\/blogs.vmware.com\/virtualblocks\/files\/2018\/10\/PowerCLI-11-8-PSM1-225x190.png 225w, https:\/\/blogs.vmware.com\/virtualblocks\/files\/2018\/10\/PowerCLI-11-8-PSM1.png 1142w\" sizes=\"auto, (max-width: 580px) 100vw, 580px\" \/><\/a><\/p>\n<p>Here&#8217;s a copy of that function: <a href=\"https:\/\/code.vmware.com\/samples\/4710\" target=\"_blank\" rel=\"noopener noreferrer\">https:\/\/code.vmware.com\/samples\/4710<\/a><\/p>\n<p>By providing these new and updated cmdlets, many of the same capabilities <em>(previously reserved to the Ruby vSphere Console or other custom code)<\/em> are now easy accomplish using PowerCLI. Administrators don&#8217;t have to log into an RVC console, move up and down the vSAN object structure, and execute scripts. Many of these can be accomplished easily and securely from an authenticated PowerCLI session.<\/p>\n<p>By bringing this information into PowerCLI, and effectively PowerShell, even more possibilities open up as PowerShell scripts interact with independent systems and applications.<\/p>\n<p>Each new release of PowerCLI continues to provide vSphere Administrators, and vSAN Administrators in this case, more extensibility, flexibility, and possibilities to easily deploy, manage, and maintain vSphere (and vSAN) environments of any scale.<\/p>\n<p><code><\/code><\/p>\n<p>This was originally posted to the VMware Virtual Blocks site: https:\/\/blogs.vmware.com\/virtualblocks\/2018\/10\/11\/more-vsan-cmdlets-in-powercli-11\/<\/p>\n","protected":false},"excerpt":{"rendered":"<p>There&#8217;s a new release of PowerCLI, and it includes some more vSAN goodness! We&#8217;ve added some capabilities previously found in the Ruby vSphere Console and &hellip; <\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[],"class_list":["post-3990","post","type-post","status-publish","format-standard","hentry","category-uncategorized"],"_links":{"self":[{"href":"https:\/\/www.jasemccarty.com\/blog\/wp-json\/wp\/v2\/posts\/3990","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=3990"}],"version-history":[{"count":2,"href":"https:\/\/www.jasemccarty.com\/blog\/wp-json\/wp\/v2\/posts\/3990\/revisions"}],"predecessor-version":[{"id":3992,"href":"https:\/\/www.jasemccarty.com\/blog\/wp-json\/wp\/v2\/posts\/3990\/revisions\/3992"}],"wp:attachment":[{"href":"https:\/\/www.jasemccarty.com\/blog\/wp-json\/wp\/v2\/media?parent=3990"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.jasemccarty.com\/blog\/wp-json\/wp\/v2\/categories?post=3990"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.jasemccarty.com\/blog\/wp-json\/wp\/v2\/tags?post=3990"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}