DeletePool(
            string resourceDisplayName,
            string poolId)
        {
            Console.WriteLine(
                "Deleting a resource pool:\n" +
                "\tPool Id: " + poolId);

            ResourceUtilities.DisplayResourceInformation(
                resourceDisplayName);

            ManagementScope scope = ResourcePoolUtilities.GetManagementScope();

            using (ManagementObject rPConfigurationService =
                       MsvmResourcePoolConfigurationService.GetResourcePoolConfigurationService(
                           scope))
            {
                DeletePoolHelper(
                    scope,
                    rPConfigurationService,
                    ResourceUtilities.GetResourceType(resourceDisplayName),
                    ResourceUtilities.GetResourceSubType(resourceDisplayName),
                    poolId);
            }
        }
        CreatePool(
            string resourceDisplayName,
            string childPoolId,
            string childPoolName,
            string parentPoolIdsString,
            string parentHostResourcesString)
        {
            Console.WriteLine(
                "Creating a resource pool:\n" +
                "\tPool Id: " + childPoolId +
                "\n\tPool Name: " + childPoolName);

            ResourceUtilities.DisplayResourceInformation(
                resourceDisplayName);

            ResourcePoolUtilities.DisplayPoolIdAndHostResources(
                parentPoolIdsString,
                parentHostResourcesString);

            string[] poolDelimter = { "[p]" };

            //
            // Pool IDs are delimted by "[p], e.g.
            //     "[p]Child Pool A[p][p]Child Pool B[p]"
            //
            string[] parentPoolIdArray = ResourcePoolUtilities.GetOneDimensionalArray(
                parentPoolIdsString,
                poolDelimter);

            string[] hostResourceDelimter = { "[h]" };

            //
            // Parent pool host resources are specified by a 2-D array. Each pool is delimited
            // by a "[p]";  Each host resource is delimited by  a "[h]". For example,
            //    "[p][h]Child A, Resource 1[h][h]Child A, Resource 2[h][p][p][h]Child B, Resource 1[h][p]"
            //
            string[][] parentHostResourcesArray = ResourcePoolUtilities.GetTwoDimensionalArray(
                parentHostResourcesString,
                poolDelimter,
                hostResourceDelimter);

            ManagementScope scope = ResourcePoolUtilities.GetManagementScope();

            using (ManagementObject rPConfigurationService =
                       MsvmResourcePoolConfigurationService.GetResourcePoolConfigurationService(
                           scope))
            {
                CreatePoolHelper(
                    scope,
                    rPConfigurationService,
                    ResourceUtilities.GetResourceType(resourceDisplayName),
                    ResourceUtilities.GetResourceSubType(resourceDisplayName),
                    childPoolId,
                    childPoolName,
                    parentPoolIdArray,
                    parentHostResourcesArray);
            }
        }
        ModifyPoolResources(
            string resourceDisplayName,
            string poolId,
            string parentPoolIdsString,
            string parentHostResourcesString)
        {
            Console.WriteLine(
                "Modifying a resource pool's host resources:\n" +
                "\tPool ID: " + poolId);

            ResourceUtilities.DisplayResourceInformation(
                resourceDisplayName);

            ResourcePoolUtilities.DisplayPoolIdAndHostResources(
                parentPoolIdsString,
                parentHostResourcesString);

            string[] poolDelimiter        = { "[p]" };
            string[] hostResourceDelimter = { "[h]" };

            string[] parentPoolIdArray = ResourcePoolUtilities.GetOneDimensionalArray(
                parentPoolIdsString,
                poolDelimiter);

            string[][] parentHostResourcesArray = ResourcePoolUtilities.GetTwoDimensionalArray(
                parentHostResourcesString,
                poolDelimiter,
                hostResourceDelimter);

            ManagementScope scope = ResourcePoolUtilities.GetManagementScope();

            using (ManagementObject rPConfigurationService =
                       MsvmResourcePoolConfigurationService.GetResourcePoolConfigurationService(
                           scope))
            {
                ModifyPoolResourcesHelper(
                    scope,
                    rPConfigurationService,
                    ResourceUtilities.GetResourceType(resourceDisplayName),
                    ResourceUtilities.GetResourceSubType(resourceDisplayName),
                    poolId,
                    parentPoolIdArray,
                    parentHostResourcesArray);
            }
        }
        ModifyPoolSettings(
            string resourceDisplayName,
            string poolId,
            string newPoolId,
            string newPoolName)
        {
            Console.WriteLine(
                "Modifying a resource pool's settings:\n" +
                "\tPool ID: " + poolId + " (change to " + newPoolId + ")\n" +
                "\tPool Name: (change to " + newPoolName + ")");

            ResourceUtilities.DisplayResourceInformation(
                resourceDisplayName);
            ManagementScope scope = ResourcePoolUtilities.GetManagementScope();

            using (ManagementObject rPConfigurationService =
                       MsvmResourcePoolConfigurationService.GetResourcePoolConfigurationService(
                           scope))
            {
                string resourcePoolSettingData =
                    MsvmResourcePoolSettingData.GetSettingsForPool(
                        scope,
                        ResourceUtilities.GetResourceType(resourceDisplayName),
                        ResourceUtilities.GetResourceSubType(resourceDisplayName),
                        newPoolId,
                        newPoolName);

                ModifyPoolSettingsHelper(
                    scope,
                    rPConfigurationService,
                    ResourceUtilities.GetResourceType(resourceDisplayName),
                    ResourceUtilities.GetResourceSubType(resourceDisplayName),
                    poolId,
                    resourcePoolSettingData);
            }
        }
 Main(
     string[] args)
 {
     if (args.Length > 0)
     {
         if (string.Equals(args[0], "EnumerateSupportedResources", StringComparison.OrdinalIgnoreCase) &&
             args.Length == 1)
         {
             ResourceUtilities.EnumerateSupportedResources();
         }
         else if (string.Equals(args[0], "CreatePool", StringComparison.OrdinalIgnoreCase) &&
                  args.Length == 6)
         {
             MsvmResourcePoolConfigurationService.CreatePool(
                 args[1],
                 args[2],
                 args[3],
                 args[4],
                 args[5]);
         }
         else if (string.Equals(args[0], "DisplayPoolResources", StringComparison.OrdinalIgnoreCase) &&
                  args.Length == 3)
         {
             MsvmResourceAllocationSettingData.DisplayPoolResourceAllocationSettingData(
                 args[1],
                 args[2]);
         }
         else if (string.Equals(args[0], "ModifyPoolResources", StringComparison.OrdinalIgnoreCase) &&
                  args.Length == 5)
         {
             MsvmResourcePoolConfigurationService.ModifyPoolResources(
                 args[1],
                 args[2],
                 args[3],
                 args[4]);
         }
         else if (string.Equals(args[0], "DisplayPoolSettings", StringComparison.OrdinalIgnoreCase) &&
                  args.Length == 3)
         {
             MsvmResourcePoolSettingData.DisplayPoolResourcePoolSettingData(
                 args[1],
                 args[2]);
         }
         else if (string.Equals(args[0], "ModifyPoolSettings", StringComparison.OrdinalIgnoreCase) &&
                  args.Length == 5)
         {
             MsvmResourcePoolConfigurationService.ModifyPoolSettings(
                 args[1],
                 args[2],
                 args[3],
                 args[4]);
         }
         else if (string.Equals(args[0], "DeletePool", StringComparison.OrdinalIgnoreCase) &&
                  args.Length == 3)
         {
             MsvmResourcePoolConfigurationService.DeletePool(
                 args[1],
                 args[2]);
         }
         else if (string.Equals(args[0], "DisplayPool", StringComparison.OrdinalIgnoreCase) &&
                  args.Length == 3)
         {
             MsvmResourcePool.DisplayPoolVerbose(
                 args[1],
                 args[2]);
         }
         else if (string.Equals(args[0], "DisplayChildPools", StringComparison.OrdinalIgnoreCase) &&
                  args.Length == 3)
         {
             MsvmResourcePool.DisplayChildPools(
                 args[1],
                 args[2]);
         }
         else if (string.Equals(args[0], "DisplayParentPools", StringComparison.OrdinalIgnoreCase) &&
                  args.Length == 3)
         {
             MsvmResourcePool.DisplayParentPools(
                 args[1],
                 args[2]);
         }
         else if (string.Equals(args[0], "DisplayAllocationCapabilities", StringComparison.OrdinalIgnoreCase) &&
                  args.Length == 3)
         {
             MsvmResourceAllocationSettingData.DisplayValidResourceAllocationSettingDataSettings(
                 args[1],
                 args[2]);
         }
         else
         {
             ShowUsage();
         }
     }
     else
     {
         ShowUsage();
     }
 }