{"id":3225,"date":"2018-06-12T15:04:51","date_gmt":"2018-06-12T19:04:51","guid":{"rendered":"https:\/\/thebackroomtech.com\/?p=3225"},"modified":"2020-01-06T14:06:47","modified_gmt":"2020-01-06T19:06:47","slug":"vmware-script-list-empty-resource-pools","status":"publish","type":"post","link":"https:\/\/thebackroomtech.com\/vmware-script-list-empty-resource-pools\/","title":{"rendered":"VMware Script &#8211; List Empty Resource Pools"},"content":{"rendered":"<p>In this article we will go over a simple script that lists all the empty resource pools in a VMware Cluster. This script comes in handy and is a very nice addition to any scripting repository where there are large VMware deployments.<\/p>\n<pre><span style=\"color: #008000;\">#Variable Declaration<\/span>\r\n<span style=\"color: #0000ff;\">Param<\/span>(\r\n    [<span style=\"color: #00ccff;\">Parameter<\/span>(Mandatory=<span style=\"color: #ff0000;\">$true<\/span>)][<span style=\"color: #33cccc;\">string<\/span>]<span style=\"color: #ff0000;\">$server<\/span>,\r\n    [<span style=\"color: #00ccff;\">Parameter<\/span>(Mandatory=<span style=\"color: #ff0000;\">$true<\/span>)][<span style=\"color: #33cccc;\">string<\/span>]<span style=\"color: #ff0000;\">$username<\/span>,\r\n    [<span style=\"color: #00ccff;\">Parameter<\/span>(Mandatory=<span style=\"color: #ff0000;\">$true<\/span>)][<span style=\"color: #33cccc;\">string<\/span>]<span style=\"color: #ff0000;\">$password<\/span>,\r\n    [<span style=\"color: #00ccff;\">Parameter<\/span>(Mandatory=<span style=\"color: #ff0000;\">$true<\/span>)][<span style=\"color: #33cccc;\">string<\/span>]<span style=\"color: #ff0000;\">$cluster<\/span>\r\n)\r\n\r\n<span style=\"color: #008000;\">#Module Initialization<\/span>\r\n<span style=\"color: #0000ff;\">Add-PSSnapin<\/span> <span style=\"color: #cc99ff;\">VMware.VimAutomation.Core<\/span>\r\n\r\n<span style=\"color: #0000ff;\">Connect-VIServer<\/span> -Server <span style=\"color: #ff0000;\">$server<\/span> -Username <span style=\"color: #ff0000;\">$username<\/span> -Password <span style=\"color: #ff0000;\">$password<\/span>\r\n<span style=\"color: #ff0000;\">$respools<\/span> = <span style=\"color: #0000ff;\">Get-Cluster<\/span> <span style=\"color: #ff0000;\">$cluster<\/span> | <span style=\"color: #0000ff;\">Get-ResourcePool<\/span>\r\nForEach (<span style=\"color: #ff0000;\">$respool<\/span> in <span style=\"color: #ff0000;\">$respools<\/span>)\r\n   {\r\n      <span style=\"color: #ff0000;\">$vms<\/span> =<span style=\"color: #0000ff;\"> Get-ResourcePool<\/span> -Name <span style=\"color: #ff0000;\">$respool<\/span> | <span style=\"color: #0000ff;\">Get-VM<\/span>\r\n      If (<span style=\"color: #ff0000;\"> $vms<\/span> -eq <span style=\"color: #ff0000;\">$null<\/span>)\r\n      {\r\n         <span style=\"color: #0000ff;\">Write-Host<\/span> <span style=\"color: #ff0000;\">$respool<\/span>\r\n      }\r\n   }<\/pre>\n<p>The following walkthrough will be an easy one.<\/p>\n<p>The first part of the script defines the parameters that we will use when running the script. The parameters are the username and password of the administrative user, the name of the vCenter Server, and the name of the Cluster.<\/p>\n<p>Afterwards we import the PowerCLI snapin to have access to the PowerCLI cmdlets and we connect to the vCenter server using the parameters we provided.<\/p>\n<p>Next, we create a variable named<strong> $respools<\/strong> that holds the output of the<strong> Get-Cluster<\/strong> command. The Get-Cluster command receives the name of the cluster as its parameter and its output is sent to the<strong> Get-ResourcePool<\/strong> cmdlet to list all the resource pools in the cluster.<\/p>\n<p>Finally, we create a <strong>ForEach<\/strong> loop to parse through the <strong>$respool<\/strong> array and then we take each resource pool from the array and pipeline the <strong>Get-VM<\/strong> cmdlet. If the Get-VM cmdlets does not return any output or if its value is<strong> $null<\/strong> (empty), then we output the name of the empty resource pool.<\/p>\n<p>That\u2019s it! A simple and effective script for your day-to-day VMware administration. Enjoy!<\/p>\n","protected":false},"excerpt":{"rendered":"<p>In this article we will go over a simple script that lists all the empty resource pools in a VMware Cluster. This script comes in handy and is a very [&hellip;]<\/p>\n","protected":false},"author":8,"featured_media":3226,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"updated_on":"","footnotes":""},"categories":[56],"tags":[],"class_list":{"0":"post-3225","1":"post","2":"type-post","3":"status-publish","4":"format-standard","5":"has-post-thumbnail","7":"category-virtualization"},"acf":[],"aioseo_notices":[],"aioseo_head":"\n\t\t<!-- All in One SEO Pro 4.9.5.2 - aioseo.com -->\n\t<meta name=\"description\" content=\"In this article we will go over a simple script that lists all the empty resource pools in a VMware Cluster. This script comes in handy and is a very nice addition to any scripting repository where there are large VMware deployments. #Variable Declaration Param( [Parameter(Mandatory=$true)][string]$server, [Parameter(Mandatory=$true)][string]$username, [Parameter(Mandatory=$true)][string]$password, [Parameter(Mandatory=$true)][string]$cluster ) #Module Initialization Add-PSSnapin VMware.VimAutomation.Core Connect-VIServer\" \/>\n\t<meta name=\"robots\" content=\"max-image-preview:large\" \/>\n\t<meta name=\"author\" content=\"Sabrin Alexander\"\/>\n\t<link rel=\"canonical\" href=\"https:\/\/thebackroomtech.com\/vmware-script-list-empty-resource-pools\/\" \/>\n\t<meta name=\"generator\" content=\"All in One SEO Pro (AIOSEO) 4.9.5.2\" \/>\n\t\t<meta property=\"og:locale\" content=\"en_US\" \/>\n\t\t<meta property=\"og:site_name\" content=\"The Back Room Tech - Serving up the info for back room techs everywhere\" \/>\n\t\t<meta property=\"og:type\" content=\"article\" \/>\n\t\t<meta property=\"og:title\" content=\"VMware Script \u2013 List Empty Resource Pools - The Back Room Tech\" \/>\n\t\t<meta property=\"og:description\" content=\"In this article we will go over a simple script that lists all the empty resource pools in a VMware Cluster. This script comes in handy and is a very nice addition to any scripting repository where there are large VMware deployments. #Variable Declaration Param( [Parameter(Mandatory=$true)][string]$server, [Parameter(Mandatory=$true)][string]$username, [Parameter(Mandatory=$true)][string]$password, [Parameter(Mandatory=$true)][string]$cluster ) #Module Initialization Add-PSSnapin VMware.VimAutomation.Core Connect-VIServer\" \/>\n\t\t<meta property=\"og:url\" content=\"https:\/\/thebackroomtech.com\/vmware-script-list-empty-resource-pools\/\" \/>\n\t\t<meta property=\"article:published_time\" content=\"2018-06-12T19:04:51+00:00\" \/>\n\t\t<meta property=\"article:modified_time\" content=\"2020-01-06T19:06:47+00:00\" \/>\n\t\t<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n\t\t<meta name=\"twitter:title\" content=\"VMware Script \u2013 List Empty Resource Pools - The Back Room Tech\" \/>\n\t\t<meta name=\"twitter:description\" content=\"In this article we will go over a simple script that lists all the empty resource pools in a VMware Cluster. This script comes in handy and is a very nice addition to any scripting repository where there are large VMware deployments. #Variable Declaration Param( [Parameter(Mandatory=$true)][string]$server, [Parameter(Mandatory=$true)][string]$username, [Parameter(Mandatory=$true)][string]$password, [Parameter(Mandatory=$true)][string]$cluster ) #Module Initialization Add-PSSnapin VMware.VimAutomation.Core Connect-VIServer\" \/>\n\t\t<script type=\"application\/ld+json\" class=\"aioseo-schema\">\n\t\t\t{\"@context\":\"https:\\\/\\\/schema.org\",\"@graph\":[]}\n\t\t<\/script>\n\t\t<!-- All in One SEO Pro -->\r\n\t\t<title>VMware Script \u2013 List Empty Resource Pools - The Back Room Tech<\/title>\n\n","aioseo_head_json":{"title":"VMware Script \u2013 List Empty Resource Pools - The Back Room Tech","description":"In this article we will go over a simple script that lists all the empty resource pools in a VMware Cluster. This script comes in handy and is a very nice addition to any scripting repository where there are large VMware deployments. #Variable Declaration Param( [Parameter(Mandatory=$true)][string]$server, [Parameter(Mandatory=$true)][string]$username, [Parameter(Mandatory=$true)][string]$password, [Parameter(Mandatory=$true)][string]$cluster ) #Module Initialization Add-PSSnapin VMware.VimAutomation.Core Connect-VIServer","canonical_url":"https:\/\/thebackroomtech.com\/vmware-script-list-empty-resource-pools\/","robots":"max-image-preview:large","keywords":"","webmasterTools":{"miscellaneous":""},"schema":{"@context":"https:\/\/schema.org","@graph":[]},"og:locale":"en_US","og:site_name":"The Back Room Tech - Serving up the info for back room techs everywhere","og:type":"article","og:title":"VMware Script \u2013 List Empty Resource Pools - The Back Room Tech","og:description":"In this article we will go over a simple script that lists all the empty resource pools in a VMware Cluster. This script comes in handy and is a very nice addition to any scripting repository where there are large VMware deployments. #Variable Declaration Param( [Parameter(Mandatory=$true)][string]$server, [Parameter(Mandatory=$true)][string]$username, [Parameter(Mandatory=$true)][string]$password, [Parameter(Mandatory=$true)][string]$cluster ) #Module Initialization Add-PSSnapin VMware.VimAutomation.Core Connect-VIServer","og:url":"https:\/\/thebackroomtech.com\/vmware-script-list-empty-resource-pools\/","article:published_time":"2018-06-12T19:04:51+00:00","article:modified_time":"2020-01-06T19:06:47+00:00","twitter:card":"summary_large_image","twitter:title":"VMware Script \u2013 List Empty Resource Pools - The Back Room Tech","twitter:description":"In this article we will go over a simple script that lists all the empty resource pools in a VMware Cluster. This script comes in handy and is a very nice addition to any scripting repository where there are large VMware deployments. #Variable Declaration Param( [Parameter(Mandatory=$true)][string]$server, [Parameter(Mandatory=$true)][string]$username, [Parameter(Mandatory=$true)][string]$password, [Parameter(Mandatory=$true)][string]$cluster ) #Module Initialization Add-PSSnapin VMware.VimAutomation.Core Connect-VIServer"},"aioseo_meta_data":{"post_id":"3225","title":null,"description":null,"keywords":null,"keyphrases":null,"primary_term":null,"canonical_url":null,"og_title":null,"og_description":null,"og_object_type":"default","og_image_type":"default","og_image_url":null,"og_image_width":null,"og_image_height":null,"og_image_custom_url":null,"og_image_custom_fields":null,"og_video":null,"og_custom_url":null,"og_article_section":null,"og_article_tags":null,"twitter_use_og":false,"twitter_card":"default","twitter_image_type":"default","twitter_image_url":null,"twitter_image_custom_url":null,"twitter_image_custom_fields":null,"twitter_title":null,"twitter_description":null,"schema":{"blockGraphs":[],"customGraphs":[],"default":{"data":{"Article":[],"Course":[],"Dataset":[],"FAQPage":[],"Movie":[],"Person":[],"Product":[],"ProductReview":[],"Car":[],"Recipe":[],"Service":[],"SoftwareApplication":[],"WebPage":[]},"graphName":"","isEnabled":true},"graphs":[]},"schema_type":"default","schema_type_options":null,"pillar_content":false,"robots_default":true,"robots_noindex":false,"robots_noarchive":false,"robots_nosnippet":false,"robots_nofollow":false,"robots_noimageindex":false,"robots_noodp":false,"robots_notranslate":false,"robots_max_snippet":null,"robots_max_videopreview":null,"robots_max_imagepreview":"large","priority":null,"frequency":null,"local_seo":null,"seo_analyzer_scan_date":"2026-03-27 20:28:51","breadcrumb_settings":null,"limit_modified_date":false,"reviewed_by":null,"open_ai":null,"ai":null,"created":"2026-03-27 20:27:05","updated":"2026-03-27 22:02:18"},"aioseo_breadcrumb":"<div class=\"aioseo-breadcrumbs\"><span class=\"aioseo-breadcrumb\">\n\t<a href=\"https:\/\/thebackroomtech.com\" title=\"Home\">Home<\/a>\n<\/span><span class=\"aioseo-breadcrumb-separator\">&raquo;<\/span><span class=\"aioseo-breadcrumb\">\n\t<a href=\"https:\/\/thebackroomtech.com\/category\/virtualization\/\" title=\"Virtualization\">Virtualization<\/a>\n<\/span><span class=\"aioseo-breadcrumb-separator\">&raquo;<\/span><span class=\"aioseo-breadcrumb\">\n\tVMware Script \u2013 List Empty Resource Pools\n<\/span><\/div>","aioseo_breadcrumb_json":[{"label":"Home","link":"https:\/\/thebackroomtech.com"},{"label":"Virtualization","link":"https:\/\/thebackroomtech.com\/category\/virtualization\/"},{"label":"VMware Script &#8211; List Empty Resource Pools","link":"https:\/\/thebackroomtech.com\/vmware-script-list-empty-resource-pools\/"}],"_links":{"self":[{"href":"https:\/\/thebackroomtech.com\/wp-json\/wp\/v2\/posts\/3225","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/thebackroomtech.com\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/thebackroomtech.com\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/thebackroomtech.com\/wp-json\/wp\/v2\/users\/8"}],"replies":[{"embeddable":true,"href":"https:\/\/thebackroomtech.com\/wp-json\/wp\/v2\/comments?post=3225"}],"version-history":[{"count":0,"href":"https:\/\/thebackroomtech.com\/wp-json\/wp\/v2\/posts\/3225\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/thebackroomtech.com\/wp-json\/wp\/v2\/media\/3226"}],"wp:attachment":[{"href":"https:\/\/thebackroomtech.com\/wp-json\/wp\/v2\/media?parent=3225"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/thebackroomtech.com\/wp-json\/wp\/v2\/categories?post=3225"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/thebackroomtech.com\/wp-json\/wp\/v2\/tags?post=3225"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}