Skip to content

Instantly share code, notes, and snippets.

@nohwnd
Last active January 15, 2017 18:59
Show Gist options
  • Save nohwnd/61c36ace27f09133339433b7502de0ff to your computer and use it in GitHub Desktop.
Save nohwnd/61c36ace27f09133339433b7502de0ff to your computer and use it in GitHub Desktop.
Create tag category
$r = "c:\Program Files (x86)\VMware\Infrastructure\PowerCLI\Modules\VMware.VimAutomation.Sdk\VMware.VimAutomation.Sdk.Types.dll",
"c:\Program Files (x86)\VMware\Infrastructure\PowerCLI\Modules\VMware.VimAutomation.Core\VMware.VimAutomation.ViCore.Types.dll"
Add-Type -ReferencedAssemblies $r -typeDefinition "
using VMware.VimAutomation.ViCore.Types.V1;
using VMware.VimAutomation.ViCore.Types.V1.Tagging;
namespace Mocks
{
public class MockTagCategory : TagCategory
{
public string Id { get; set; }
public string Name { get; set; }
public string Description { get; set; }
public Cardinality Cardinality { get; set; }
public string[] EntityType { get; set; }
public string Uid { get; set; }
}
}"
$tagCategory = new-object Mocks.MockTagCategory
$tagCategory -is [VMware.VimAutomation.ViCore.Types.V1.Tagging.TagCategory]
$tagCategory.Name = "my mock category"
$tagCategory
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment