<?xml version="1.0"?><?xml-stylesheet type="text/xsl" href="http://www.codeplex.com/rss.xsl"?><rss version="2.0"><channel><title>vitoolkitextensions Wiki &amp; Documentation Rss Feed</title><link>http://www.codeplex.com/vitoolkitextensions/Wiki/View.aspx?title=Home</link><description>vitoolkitextensions Wiki Rss Description</description><item><title>Updated Wiki: examples</title><link>http://www.codeplex.com/vitoolkitextensions/Wiki/View.aspx?title=examples&amp;version=5</link><description>&lt;div class="wikidoc"&gt;
&lt;h2&gt;
Examples
&lt;/h2&gt;&lt;a href="http://www.codeplex.com/vitoolkitextensions/Wiki/View.aspx?title=Roles%2c%20privileges%20and%20permissions&amp;amp;referringTitle=examples"&gt;Roles, privileges and permissions&lt;/a&gt;&lt;br /&gt;&lt;a href="http://www.codeplex.com/vitoolkitextensions/Wiki/View.aspx?title=Guest%20OS%20ids&amp;amp;referringTitle=examples"&gt;Guest OS ids&lt;/a&gt;&lt;br /&gt;
&lt;/div&gt;</description><author>LucD</author><pubDate>Thu, 01 Jan 2009 10:49:20 GMT</pubDate><guid isPermaLink="false">Updated Wiki: examples 20090101104920A</guid></item><item><title>Updated Wiki: Guest OS ids</title><link>http://www.codeplex.com/vitoolkitextensions/Wiki/View.aspx?title=Guest OS ids&amp;version=1</link><description>&lt;div class="wikidoc"&gt;
&lt;b&gt;Guest OS ids&lt;/b&gt;&lt;br /&gt;See Carter's entry in his &lt;a href="http://blogs.vmware.com/vipowershell/2008/12/just-what-guest-types-can-you-use-with-new-vm.html" class="externalLink"&gt;VI Toolkit (for Windows)&lt;span class="externalLinkIcon"&gt;&lt;/span&gt;&lt;/a&gt; blog.&lt;br /&gt;
&lt;/div&gt;</description><author>LucD</author><pubDate>Thu, 01 Jan 2009 10:46:58 GMT</pubDate><guid isPermaLink="false">Updated Wiki: Guest OS ids 20090101104658A</guid></item><item><title>Updated Wiki: examples</title><link>http://www.codeplex.com/vitoolkitextensions/Wiki/View.aspx?title=examples&amp;version=4</link><description>&lt;div class="wikidoc"&gt;
&lt;h1&gt;
Examples
&lt;/h1&gt;&lt;a href="http://www.codeplex.com/vitoolkitextensions/Wiki/View.aspx?title=Roles%2c%20privileges%20and%20permissions&amp;amp;referringTitle=examples"&gt;Roles, privileges and permissions&lt;/a&gt;&lt;br /&gt;&lt;a href="http://www.codeplex.com/vitoolkitextensions/Wiki/View.aspx?title=Guest%20OS%20ids&amp;amp;referringTitle=examples"&gt;Guest OS ids&lt;/a&gt;&lt;br /&gt;
&lt;/div&gt;</description><author>LucD</author><pubDate>Thu, 01 Jan 2009 10:42:54 GMT</pubDate><guid isPermaLink="false">Updated Wiki: examples 20090101104254A</guid></item><item><title>Updated Wiki: Roles, privileges and permissions</title><link>http://www.codeplex.com/vitoolkitextensions/Wiki/View.aspx?title=Roles, privileges and permissions&amp;version=1</link><description>&lt;div class="wikidoc"&gt;
&lt;b&gt;Roles, privileges and permissions&lt;/b&gt;&lt;br /&gt;The security in virtual infrastructure (VI) is organised around&lt;br /&gt;&lt;ul&gt;
&lt;li&gt;&lt;b&gt;privileges&lt;/b&gt;, specific rights on ESX Servers, Virtual Machines, or other VI objects. For example the right to start a Virtual Machine&lt;/li&gt;&lt;li&gt;&lt;b&gt;roles&lt;/b&gt;, are objects that group specific rights together for easier assignment. The Virtual Machine User role has several rights to intercat with a guest.&lt;/li&gt;&lt;li&gt;&lt;b&gt;permissions&lt;/b&gt;, is where you combine users, or groups, with specific roles.&lt;/li&gt;
&lt;/ul&gt; &lt;br /&gt;To see all the available privileges in VI you can do:&lt;br /&gt; &lt;br /&gt;&lt;pre&gt;
PS C:\&amp;gt; Get-TkeAllPriviliges
 
Name                                                          OnParent privGroupName                      privId
----                                                          -------- -------------                      ------
Anonymous                                                        False System                             System.Anonymous
View                                                             False System                             System.View
Read                                                             False System                             System.Read
ManageCustomFields                                               False Global                             Global.ManageCustomFields
&lt;/pre&gt; &lt;br /&gt;This advanced function returns an array of &lt;a href="http://www.vmware.com/support/developer/vc-sdk/visdk25pubs/ReferenceGuide/vim.AuthorizationManager.Privilege.html" class="externalLink"&gt;AuthorizationPrivilege&lt;span class="externalLinkIcon"&gt;&lt;/span&gt;&lt;/a&gt; objects.&lt;br /&gt;See the API Reference guide for an explanation of the properties.&lt;br /&gt; &lt;br /&gt;To see the roles that are currently defined in the VI you can do:&lt;br /&gt; &lt;br /&gt;&lt;pre&gt;
PS C:\&amp;gt; Get-TkeRoles
 
 
Name      : NoAccess
Label     : No Access
Summary   : Used for restricting granted access
RoleId    : -5
System    : True
Privilege :
 
Name      : Anonymous
Label     : Anonymous
Summary   : Not logged-in user (cannot be granted)
RoleId    : -4
System    : True
Privilege : {System.Anonymous}
 
Name      : View
Label     : View
Summary   : Visibility access (cannot be granted)
RoleId    : -3
System    : True
Privilege : {System.Anonymous, System.View}
&lt;/pre&gt; &lt;br /&gt;VI comes with a number of pre-defined roles.&lt;br /&gt;These pre-defined roles all have a negative &lt;b&gt;RoleId&lt;/b&gt; number and cannot be changed.&lt;br /&gt; &lt;br /&gt;To see the privileges that are grouped under a specific role you could do&lt;br /&gt; &lt;br /&gt;&lt;pre&gt;
PS C:\&amp;gt; Get-TkeRoles | where {$_.Name -eq &amp;quot;ReadOnly&amp;quot;} | select -ExpandProperty Privilege
System.Anonymous
System.Read
System.View
&lt;/pre&gt; &lt;br /&gt;but there is a specific advanced function to do just that&lt;br /&gt;&lt;pre&gt;
PS C:\&amp;gt; Get-TkeRolePrivileges -name &amp;quot;readonly&amp;quot;
 
Name                                                          OnParent privGroupName                      privId
----                                                          -------- -------------                      ------
Anonymous                                                        False System                             System.Anonymous
View                                                             False System                             System.View
Read                                                             False System                             System.Read
&lt;/pre&gt; &lt;br /&gt;Note that the names of the roles do not always correspond literaly with the role names you see in the VI Client.&lt;br /&gt; &lt;br /&gt;To create a new role with a specific set of privileges you can do&lt;br /&gt; &lt;br /&gt;&lt;pre&gt;
PS C:\&amp;gt; New-TkeRole -name &amp;quot;My new role&amp;quot; -privIds &amp;quot;VirtualMachine.Interact.PowerOn&amp;quot;,&amp;quot;VirtualMachine.Interact.PowerOff&amp;quot;
110
&lt;/pre&gt; &lt;br /&gt;The advanced function returns the &lt;b&gt;roleId&lt;/b&gt; of the new role.&lt;br /&gt; &lt;br /&gt;&lt;b&gt;Note&lt;/b&gt; that the privilege Ids are case-sensitive !&lt;br /&gt; &lt;br /&gt;You can also start from one of the pre-defined roles.&lt;br /&gt;For that it suffices to clone the role.&lt;br /&gt; &lt;br /&gt;&lt;pre&gt;
PS C:\&amp;gt; Clone-TkeRole &amp;quot;VirtualMachineUser&amp;quot; &amp;quot;My Cloned Role&amp;quot;
113
&lt;/pre&gt; &lt;br /&gt;This advanced function will return the roleId of the new role, similar to the New-TkeRole advanced function.&lt;br /&gt; &lt;br /&gt;If you want to make changes to the privileges assigned to a user-defined role (remember, the roles with the positive roleId numbers) you can do&lt;br /&gt; &lt;br /&gt;&lt;pre&gt;
PS C:\&amp;gt; Set-TkeRole -name &amp;quot;My new role&amp;quot; -privIds &amp;quot;VirtualMachine.Interact.Suspend&amp;quot;
&lt;/pre&gt; &lt;br /&gt; &lt;br /&gt;The Set-TkeRol cmdlet has a parameter, called -append, which allows you to specify if the privileges need to be added (-append:$true) to the existing privileges or need to replace (-append:$false) the existing privileges.&lt;br /&gt; &lt;br /&gt;&lt;pre&gt;
PS C:\&amp;gt; Set-TkeRole -name &amp;quot;My new role&amp;quot; -privIds &amp;quot;VirtualMachine.Interact.Reset&amp;quot; -append:$true
&lt;/pre&gt; &lt;br /&gt; &lt;br /&gt;You can also change the name of a user-defined role&lt;br /&gt; &lt;br /&gt;&lt;pre&gt;
PS C:\&amp;gt; Set-TkeRole -name &amp;quot;My new role&amp;quot; -newName &amp;quot;A new name for the role&amp;quot;
&lt;/pre&gt; &lt;br /&gt; &lt;br /&gt;If a role becomes obsolete, you can remove it like this&lt;br /&gt; &lt;br /&gt;&lt;pre&gt;
PS C:\&amp;gt; Remove-TkeRole -name &amp;quot;A new name for the role&amp;quot;
&lt;/pre&gt; &lt;br /&gt;As a failsafe this cmdlet has a switch, called &lt;b&gt;-FailIfUsed&lt;/b&gt;, which prohibits the removal of the role if the role is used in a permission.&lt;br /&gt;The default for this switch is -FailIfUsed:$true.&lt;br /&gt; &lt;br /&gt;&lt;pre&gt;
PS C:\&amp;gt; Remove-TkeRole -name &amp;quot;A new name for the role&amp;quot; -FailIfUsed:$false
&lt;/pre&gt; &lt;br /&gt; &lt;br /&gt;Once you have the roles set up like you want, you can start assigning permissions.&lt;br /&gt; &lt;br /&gt;A permission can be used on practicaly all of the VI objects.&lt;br /&gt;As a guideline, if the object has a Permissions tab in the VI Client, you assign permissions to it.&lt;br /&gt; &lt;br /&gt;To set a permission, use the &lt;b&gt;Set-TkePermissions&lt;/b&gt; advanced function.&lt;br /&gt;The &lt;b&gt;-permission&lt;/b&gt; parameter accepts one or more (an array) &lt;a href="http://www.vmware.com/support/developer/vc-sdk/visdk25pubs/ReferenceGuide/vim.AuthorizationManager.Permission.html" class="externalLink"&gt;Permission&lt;span class="externalLinkIcon"&gt;&lt;/span&gt;&lt;/a&gt; object(s).&lt;br /&gt;See the API Reference guide for an explanation of the properties.&lt;br /&gt; &lt;br /&gt;In this example we assign the privileges, defined in the &lt;b&gt;ReadOnly&lt;/b&gt; role, to the user account &lt;b&gt;Test\Guest&lt;/b&gt;.&lt;br /&gt;The permission will only be applied to the object itself, not to any of it's cildren.&lt;br /&gt; &lt;br /&gt;&lt;pre&gt;
PS C:\&amp;gt; $MyPermission = New-Object VMware.Vim.Permission
PS C:\&amp;gt; $MyPermission.principal = &amp;quot;Test\Guest&amp;quot;
PS C:\&amp;gt; $MyPermission.group = $false
PS C:\&amp;gt; $myPermission.propagate = $false
PS C:\&amp;gt; $MyPermission.RoleId = (Get-TkeRoles | Where-Object {$_.Name -eq &amp;quot;ReadOnly&amp;quot;} | % {$_.RoleId})
PS C:\&amp;gt; Get-VM PC2 | Set-TkePermissions -permission $myPermission
PS C:\&amp;gt; Get-VM PC2 | Get-TkePermissions
 
Entity    : PC2
Group     : False
Principal : TEST\Guest
Propagate : False
Role      : ReadOnly
&lt;/pre&gt; &lt;br /&gt;The example also showed the use of the &lt;b&gt;Get-TkePermissions&lt;/b&gt; cmdlet.&lt;br /&gt;This will list all permissions that are set on a VI object.&lt;br /&gt; &lt;br /&gt;If you also want to see the permissions that were inherited for that object, you need to use the &lt;b&gt;-inherited&lt;/b&gt; parameter.&lt;br /&gt; &lt;br /&gt;&lt;pre&gt;
PS C:\&amp;gt; Get-VM PC2 | Get-TkePermissions -inherited:$true
 
 
Entity    : PC2
Group     : False
Principal : TEST\Guest
Propagate : False
Role      : ReadOnly
 
Entity    : Datacenters
Group     : True
Principal : TEST\Domain Admins
Propagate : True
Role      : Admin
&lt;/pre&gt; &lt;br /&gt;The removal of a permission is rather straight-forward.&lt;br /&gt; &lt;br /&gt;&lt;pre&gt;
PS C:\&amp;gt; Get-VM PC2 | Remove-TkePermissions -principal &amp;quot;Test\Guest&amp;quot;
&lt;/pre&gt; &lt;br /&gt;
&lt;/div&gt;</description><author>LucD</author><pubDate>Thu, 01 Jan 2009 10:40:44 GMT</pubDate><guid isPermaLink="false">Updated Wiki: Roles, privileges and permissions 20090101104044A</guid></item><item><title>Updated Wiki: examples</title><link>http://www.codeplex.com/vitoolkitextensions/Wiki/View.aspx?title=examples&amp;version=3</link><description>&lt;div class="wikidoc"&gt;
&lt;h1&gt;
Examples
&lt;/h1&gt;&lt;a href="http://www.codeplex.com/vitoolkitextensions/Wiki/View.aspx?title=Roles%2c%20privileges%20and%20permissions&amp;amp;referringTitle=examples"&gt;Roles, privileges and permissions&lt;/a&gt;&lt;br /&gt;
&lt;/div&gt;</description><author>LucD</author><pubDate>Thu, 01 Jan 2009 10:40:19 GMT</pubDate><guid isPermaLink="false">Updated Wiki: examples 20090101104019A</guid></item><item><title>Updated Wiki: examples</title><link>http://www.codeplex.com/vitoolkitextensions/Wiki/View.aspx?title=examples&amp;version=2</link><description>&lt;div class="wikidoc"&gt;
&lt;b&gt;Roles, privileges and permissions&lt;/b&gt;&lt;br /&gt;The security in virtual infrastructure (VI) is organised around&lt;br /&gt;&lt;ul&gt;
&lt;li&gt;&lt;b&gt;privileges&lt;/b&gt;, specific rights on ESX Servers, Virtual Machines, or other VI objects. For example the right to start a Virtual Machine&lt;/li&gt;&lt;li&gt;&lt;b&gt;roles&lt;/b&gt;, are objects that group specific rights together for easier assignment. The Virtual Machine User role has several rights to intercat with a guest.&lt;/li&gt;&lt;li&gt;&lt;b&gt;permissions&lt;/b&gt;, is where you combine users, or groups, with specific roles.&lt;/li&gt;
&lt;/ul&gt; &lt;br /&gt;To see all the available privileges in VI you can do:&lt;br /&gt; &lt;br /&gt;&lt;pre&gt;
PS C:\&amp;gt; Get-TkeAllPriviliges
 
Name                                                          OnParent privGroupName                      privId
----                                                          -------- -------------                      ------
Anonymous                                                        False System                             System.Anonymous
View                                                             False System                             System.View
Read                                                             False System                             System.Read
ManageCustomFields                                               False Global                             Global.ManageCustomFields
&lt;/pre&gt; &lt;br /&gt;This advanced function returns an array of &lt;a href="http://www.vmware.com/support/developer/vc-sdk/visdk25pubs/ReferenceGuide/vim.AuthorizationManager.Privilege.html" class="externalLink"&gt;AuthorizationPrivilege&lt;span class="externalLinkIcon"&gt;&lt;/span&gt;&lt;/a&gt; objects.&lt;br /&gt;See the API Reference guide for an explanation of the properties.&lt;br /&gt; &lt;br /&gt;To see the roles that are currently defined in the VI you can do:&lt;br /&gt; &lt;br /&gt;&lt;pre&gt;
PS C:\&amp;gt; Get-TkeRoles
 
 
Name      : NoAccess
Label     : No Access
Summary   : Used for restricting granted access
RoleId    : -5
System    : True
Privilege :
 
Name      : Anonymous
Label     : Anonymous
Summary   : Not logged-in user (cannot be granted)
RoleId    : -4
System    : True
Privilege : {System.Anonymous}
 
Name      : View
Label     : View
Summary   : Visibility access (cannot be granted)
RoleId    : -3
System    : True
Privilege : {System.Anonymous, System.View}
&lt;/pre&gt; &lt;br /&gt;VI comes with a number of pre-defined roles.&lt;br /&gt;These pre-defined roles all have a negative &lt;b&gt;RoleId&lt;/b&gt; number and cannot be changed.&lt;br /&gt; &lt;br /&gt;To see the privileges that are grouped under a specific role you could do&lt;br /&gt; &lt;br /&gt;&lt;pre&gt;
PS C:\&amp;gt; Get-TkeRoles | where {$_.Name -eq &amp;quot;ReadOnly&amp;quot;} | select -ExpandProperty Privilege
System.Anonymous
System.Read
System.View
&lt;/pre&gt; &lt;br /&gt;but there is a specific advanced function to do just that&lt;br /&gt;&lt;pre&gt;
PS C:\&amp;gt; Get-TkeRolePrivileges -name &amp;quot;readonly&amp;quot;
 
Name                                                          OnParent privGroupName                      privId
----                                                          -------- -------------                      ------
Anonymous                                                        False System                             System.Anonymous
View                                                             False System                             System.View
Read                                                             False System                             System.Read
&lt;/pre&gt; &lt;br /&gt;Note that the names of the roles do not always correspond literaly with the role names you see in the VI Client.&lt;br /&gt; &lt;br /&gt;To create a new role with a specific set of privileges you can do&lt;br /&gt; &lt;br /&gt;&lt;pre&gt;
PS C:\&amp;gt; New-TkeRole -name &amp;quot;My new role&amp;quot; -privIds &amp;quot;VirtualMachine.Interact.PowerOn&amp;quot;,&amp;quot;VirtualMachine.Interact.PowerOff&amp;quot;
110
&lt;/pre&gt; &lt;br /&gt;The advanced function returns the &lt;b&gt;roleId&lt;/b&gt; of the new role.&lt;br /&gt; &lt;br /&gt;&lt;b&gt;Note&lt;/b&gt; that the privilege Ids are case-sensitive !&lt;br /&gt; &lt;br /&gt;You can also start from one of the pre-defined roles.&lt;br /&gt;For that it suffices to clone the role.&lt;br /&gt; &lt;br /&gt;&lt;pre&gt;
PS C:\&amp;gt; Clone-TkeRole &amp;quot;VirtualMachineUser&amp;quot; &amp;quot;My Cloned Role&amp;quot;
113
&lt;/pre&gt; &lt;br /&gt;This advanced function will return the roleId of the new role, similar to the New-TkeRole advanced function.&lt;br /&gt; &lt;br /&gt;If you want to make changes to the privileges assigned to a user-defined role (remember, the roles with the positive roleId numbers) you can do&lt;br /&gt; &lt;br /&gt;&lt;pre&gt;
PS C:\&amp;gt; Set-TkeRole -name &amp;quot;My new role&amp;quot; -privIds &amp;quot;VirtualMachine.Interact.Suspend&amp;quot;
&lt;/pre&gt; &lt;br /&gt; &lt;br /&gt;The Set-TkeRol cmdlet has a parameter, called -append, which allows you to specify if the privileges need to be added (-append:$true) to the existing privileges or need to replace (-append:$false) the existing privileges.&lt;br /&gt; &lt;br /&gt;&lt;pre&gt;
PS C:\&amp;gt; Set-TkeRole -name &amp;quot;My new role&amp;quot; -privIds &amp;quot;VirtualMachine.Interact.Reset&amp;quot; -append:$true
&lt;/pre&gt; &lt;br /&gt; &lt;br /&gt;You can also change the name of a user-defined role&lt;br /&gt; &lt;br /&gt;&lt;pre&gt;
PS C:\&amp;gt; Set-TkeRole -name &amp;quot;My new role&amp;quot; -newName &amp;quot;A new name for the role&amp;quot;
&lt;/pre&gt; &lt;br /&gt; &lt;br /&gt;If a role becomes obsolete, you can remove it like this&lt;br /&gt; &lt;br /&gt;&lt;pre&gt;
PS C:\&amp;gt; Remove-TkeRole -name &amp;quot;A new name for the role&amp;quot;
&lt;/pre&gt; &lt;br /&gt;As a failsafe this cmdlet has a switch, called &lt;b&gt;-FailIfUsed&lt;/b&gt;, which prohibits the removal of the role if the role is used in a permission.&lt;br /&gt;The default for this switch is -FailIfUsed:$true.&lt;br /&gt; &lt;br /&gt;&lt;pre&gt;
PS C:\&amp;gt; Remove-TkeRole -name &amp;quot;A new name for the role&amp;quot; -FailIfUsed:$false
&lt;/pre&gt; &lt;br /&gt; &lt;br /&gt;Once you have the roles set up like you want, you can start assigning permissions.&lt;br /&gt; &lt;br /&gt;A permission can be used on practicaly all of the VI objects.&lt;br /&gt;As a guideline, if the object has a Permissions tab in the VI Client, you assign permissions to it.&lt;br /&gt; &lt;br /&gt;To set a permission, use the &lt;b&gt;Set-TkePermissions&lt;/b&gt; advanced function.&lt;br /&gt;The &lt;b&gt;-permission&lt;/b&gt; parameter accepts one or more (an array) &lt;a href="http://www.vmware.com/support/developer/vc-sdk/visdk25pubs/ReferenceGuide/vim.AuthorizationManager.Permission.html" class="externalLink"&gt;Permission&lt;span class="externalLinkIcon"&gt;&lt;/span&gt;&lt;/a&gt; object(s).&lt;br /&gt;See the API Reference guide for an explanation of the properties.&lt;br /&gt; &lt;br /&gt;In this example we assign the privileges, defined in the &lt;b&gt;ReadOnly&lt;/b&gt; role, to the user account &lt;b&gt;Test\Guest&lt;/b&gt;.&lt;br /&gt;The permission will only be applied to the object itself, not to any of it's cildren.&lt;br /&gt; &lt;br /&gt;&lt;pre&gt;
PS C:\&amp;gt; $MyPermission = New-Object VMware.Vim.Permission
PS C:\&amp;gt; $MyPermission.principal = &amp;quot;Test\Guest&amp;quot;
PS C:\&amp;gt; $MyPermission.group = $false
PS C:\&amp;gt; $myPermission.propagate = $false
PS C:\&amp;gt; $MyPermission.RoleId = (Get-TkeRoles | Where-Object {$_.Name -eq &amp;quot;ReadOnly&amp;quot;} | % {$_.RoleId})
PS C:\&amp;gt; Get-VM PC2 | Set-TkePermissions -permission $myPermission
PS C:\&amp;gt; Get-VM PC2 | Get-TkePermissions
 
Entity    : PC2
Group     : False
Principal : TEST\Guest
Propagate : False
Role      : ReadOnly
&lt;/pre&gt; &lt;br /&gt;The example also showed the use of the &lt;b&gt;Get-TkePermissions&lt;/b&gt; cmdlet.&lt;br /&gt;This will list all permissions that are set on a VI object.&lt;br /&gt; &lt;br /&gt;If you also want to see the permissions that were inherited for that object, you need to use the &lt;b&gt;-inherited&lt;/b&gt; parameter.&lt;br /&gt; &lt;br /&gt;&lt;pre&gt;
PS C:\&amp;gt; Get-VM PC2 | Get-TkePermissions -inherited:$true
 
 
Entity    : PC2
Group     : False
Principal : TEST\Guest
Propagate : False
Role      : ReadOnly
 
Entity    : Datacenters
Group     : True
Principal : TEST\Domain Admins
Propagate : True
Role      : Admin
&lt;/pre&gt; &lt;br /&gt;The removal of a permission is rather straight-forward.&lt;br /&gt; &lt;br /&gt;&lt;pre&gt;
PS C:\&amp;gt; Get-VM PC2 | Remove-TkePermissions -principal &amp;quot;Test\Guest&amp;quot;
&lt;/pre&gt; &lt;br /&gt;
&lt;/div&gt;</description><author>LucD</author><pubDate>Wed, 31 Dec 2008 19:43:32 GMT</pubDate><guid isPermaLink="false">Updated Wiki: examples 20081231074332P</guid></item><item><title>Updated Wiki: guidelines</title><link>http://www.codeplex.com/vitoolkitextensions/Wiki/View.aspx?title=guidelines&amp;version=1</link><description>&lt;div class="wikidoc"&gt;
&lt;h1&gt;
Guidelines for Community Extensions Advanced Functions
&lt;/h1&gt; &lt;br /&gt;(Please note, under construction)&lt;br /&gt; &lt;br /&gt;&lt;h2&gt;
Naming Conventions
&lt;/h2&gt;PowerShell's naming convention is &lt;b&gt;Verb-SingularNoun&lt;/b&gt;. For example &lt;b&gt;Get-VM&lt;/b&gt; where Get is a verb and VM is a singular noun. The singular noun convention means you don't define a cmdlet like &lt;b&gt;Get-VMsOnHost&lt;/b&gt; since this introduces two separate concepts (the VMs and the Hosts they run on). Additionally, PowerShell defines a set of &lt;a href="http://msdn.microsoft.com/en-us/library/ms714428(VS.85).aspx" class="externalLink"&gt;recommended verbs&lt;span class="externalLinkIcon"&gt;&lt;/span&gt;&lt;/a&gt; that you are encouraged to use.&lt;br /&gt; &lt;br /&gt;There are exceptions to these rules, both in PowerShell products produced by Microsoft and other parties. In general though, it's best to stick as close to this basic naming guideline as possible.&lt;br /&gt; &lt;br /&gt;In the Community Extensions there is an additional constraint placed on naming guidelines: to help identify commands as coming from the Community Extensions they must be prefaced with &amp;quot;Tke&amp;quot;, which stands for &amp;quot;Toolkit Extensions&amp;quot;.&lt;br /&gt; &lt;br /&gt;Examples:&lt;br /&gt;    * Get-TkeVmxEntries&lt;br /&gt;    * Restart-TkeVMHost&lt;br /&gt; &lt;br /&gt;If you are writing a Set-* function, you are encouraged to also write a Get-* cmdlet that will produce objects for the Set-* function to operate upon. Get-* cmdlets are important for selecting the objects on which users wish to operate, as well as other functions like creating reports.&lt;br /&gt; &lt;br /&gt;Capitalization should follow the &lt;a href="http://msdn.microsoft.com/en-us/library/ms229043.aspx" class="externalLink"&gt;recommended practices for .NET code&lt;span class="externalLinkIcon"&gt;&lt;/span&gt;&lt;/a&gt;.&lt;br /&gt; &lt;br /&gt;&lt;h2&gt;
Defining Parameters
&lt;/h2&gt;A full explanation of defining parameters can be found by typing &lt;b&gt;help about&lt;i&gt;functions&lt;/i&gt;advanced_parameters&lt;/b&gt; at your PowerShell prompt. For now here's an example with some commentary:&lt;br /&gt;&lt;pre&gt;
function Get-TkeDatastoreFile {
param(
	[Parameter(Mandatory=$true,ValueFromPipeline=$true,HelpMessage=&amp;quot;Datastores to get files from&amp;quot;)]
	[VMware.VimAutomation.Client20.DatastoreImpl[]]
	$datastore,
 
	[Parameter(HelpMessage=&amp;quot;Subpath to search&amp;quot;)]
	[string]
	$subpath = &amp;quot;&amp;quot;,
 
	[Parameter(HelpMessage=&amp;quot;If set to true, don't get the file size&amp;quot;)]
	[switch]
	$noSize,
 
	[Parameter(HelpMessage=&amp;quot;If set to true, don't get the file type&amp;quot;)]
	[switch]
	$noType,
 
	[Parameter(HelpMessage=&amp;quot;If set to true, don't get the file modification date&amp;quot;)]
	[switch]
	$noModification
)
&lt;/pre&gt; &lt;br /&gt; &lt;br /&gt;This code defines one parameter set. The first parameter, $datastore, is mandatory and is also accepted on the pipeline. The type of $datastore is an array of VMware.VimAutomation.Client20.DatastoreImpl objects, which helps PowerShell know whether a given object on the pipeline should be accepted or not. The second argumetn sets a default value of the empty string. The last 3 arguments, noSize, noType and noModification are switch parameters. For example, if this function is called as &lt;b&gt;Get-TkeDatastoreFile -noType&lt;/b&gt;, $noType will be set to $true while $noSize and $noModification will both be set to $false.&lt;br /&gt; &lt;br /&gt;If you're ever unsure about the type of an object, you can always call its GetType() method to find out what it is, for example:&lt;br /&gt;&lt;pre&gt;
&amp;gt; $str = &amp;quot;fdsa&amp;quot;
&amp;gt; $str.GetType()
 
IsPublic IsSerial Name                                     BaseType
-------- -------- ----                                     --------
True     True     String                                   System.Object
&lt;/pre&gt; &lt;br /&gt; &lt;br /&gt;&lt;h2&gt;
Begin, Process and End
&lt;/h2&gt; &lt;br /&gt;&lt;h2&gt;
Dealing with tasks
&lt;/h2&gt; &lt;br /&gt;&lt;h2&gt;
Supporting -Whatif and -Confirm
&lt;/h2&gt;If you function changes system state it should support -Whatif and -Confirm. Examples include changing a system setting, creating a new object (like a VM) or removing an existing object. Adding -Whatif and -Confirm support is done with the &lt;b&gt;CmdletBinding&lt;/b&gt; directive, for example:&lt;br /&gt;&lt;pre&gt;
[CmdletBinding(SupportsShouldProcess=$true,ConfirmImpact=&amp;quot;high&amp;quot;)]
&lt;/pre&gt; &lt;br /&gt; &lt;br /&gt;If your function defines these, your function will have access to a variable called &lt;b&gt;$psfunction&lt;/b&gt; that you can use to support -Whatif and -Confirm. All you need to do then is, before taking action that would change system state, make a call like this:&lt;br /&gt;&lt;pre&gt;
if (($psfunction.ShouldProcess($objectName, $message))) {
	// Change the system.
}
&lt;/pre&gt; &lt;br /&gt; &lt;br /&gt;If the user has specified -Whatif, they will simply get a message showing them the object name and message. If -Confirm has been specified, and the functions ConfirmImpact setting is greater than or equal to than the user's $ConfirmPreference variable, they will be prompted to decide if the action should truly take place.&lt;br /&gt; &lt;br /&gt;&lt;h2&gt;
Documentation
&lt;/h2&gt;Advanced functions can have documentation embedded in the module that is displayed when a user types &lt;b&gt;help Your-AdvancedFunction&lt;/b&gt;.&lt;br /&gt; &lt;br /&gt;For example, this code snippet defines help for the &lt;b&gt;Defrobulate-Modulator&lt;/b&gt; cmdlet.&lt;br /&gt;&lt;pre&gt;
&amp;lt;#
.SYNOPSIS
Removes all frobulations from the system modulator.
.DESCRIPTION
Only use this command if you are a certified modulator technician.
.LINK
Frobulate-Modulator
#&amp;gt;
Function Defrobulate-Modulator {
	# Code withheld pending patent approval.
}
&lt;/pre&gt; &lt;br /&gt; &lt;br /&gt;When the user types *help Defrobulate-Modulator at his prompt, the following is produced:&lt;br /&gt;&lt;pre&gt;
PS&amp;gt; help defrobulate-modulator
NAME
    Defrobulate-Modulator
 
SYNOPSIS
    Removes all frobulations from the system modulator.
 
 
SYNTAX
    Defrobulate-Modulator [&amp;lt;CommonParameters&amp;gt;]
 
 
DETAILED DESCRIPTION
    Only use this command if you are a certified modulator technician.
 
 
RELATED LINKS
    Frobulate-Modulator
 
REMARKS
    To see the examples, type: &amp;quot;get-help Defrobulate-Modulator -examples&amp;quot;.
    For more information, type: &amp;quot;get-help Defrobulate-Modulator -detailed&amp;quot;.
    For technical information, type: &amp;quot;get-help Defrobulate-Modulator -full&amp;quot;.
&lt;/pre&gt; &lt;br /&gt; &lt;br /&gt;Following is a list of all documentation sections.&lt;br /&gt;
&lt;/div&gt;</description><author>cartershanklin</author><pubDate>Wed, 31 Dec 2008 18:25:27 GMT</pubDate><guid isPermaLink="false">Updated Wiki: guidelines 20081231062527P</guid></item><item><title>Updated Wiki: examples</title><link>http://www.codeplex.com/vitoolkitextensions/Wiki/View.aspx?title=examples&amp;version=1</link><description>&lt;div class="wikidoc"&gt;
&lt;b&gt;Roles, privileges and permissions&lt;/b&gt;&lt;br /&gt;The security in virtual infrastructure (VI) is organised around&lt;br /&gt;&lt;ul&gt;
&lt;li&gt;&lt;b&gt;privileges&lt;/b&gt;, specific rights on ESX Servers, Virtual Machines, or other VI objects. For example the right to start a Virtual Machine&lt;/li&gt;&lt;li&gt;&lt;b&gt;roles&lt;/b&gt;, are objects that group specific rights together for easier assignment. The Virtual Machine User role has several rights to intercat with a guest.&lt;/li&gt;&lt;li&gt;&lt;b&gt;permissions&lt;/b&gt;, is where you combine users, or groups, with specific roles.&lt;/li&gt;
&lt;/ul&gt; &lt;br /&gt;To see all the available privileges in VI you can do:&lt;br /&gt; &lt;br /&gt;&lt;pre&gt;
PS C:\&amp;gt; Get-TkeAllPriviliges
 
Name                                                          OnParent privGroupName                      privId
----                                                          -------- -------------                      ------
Anonymous                                                        False System                             System.Anonymous
View                                                             False System                             System.View
Read                                                             False System                             System.Read
ManageCustomFields                                               False Global                             Global.ManageCustomFields
&lt;/pre&gt; &lt;br /&gt;This advanced function returns an array of &lt;a href="http://www.vmware.com/support/developer/vc-sdk/visdk25pubs/ReferenceGuide/vim.AuthorizationManager.Privilege.html" class="externalLink"&gt;AuthorizationPrivilege&lt;span class="externalLinkIcon"&gt;&lt;/span&gt;&lt;/a&gt; objects.&lt;br /&gt;See the API Reference guide for an explanation of the properties.&lt;br /&gt; &lt;br /&gt;To see the roles that are currently defined in the VI you can do:&lt;br /&gt; &lt;br /&gt;&lt;pre&gt;
PS C:\&amp;gt; Get-TkeRoles
 
 
Name      : NoAccess
Label     : No Access
Summary   : Used for restricting granted access
RoleId    : -5
System    : True
Privilege :
 
Name      : Anonymous
Label     : Anonymous
Summary   : Not logged-in user (cannot be granted)
RoleId    : -4
System    : True
Privilege : {System.Anonymous}
 
Name      : View
Label     : View
Summary   : Visibility access (cannot be granted)
RoleId    : -3
System    : True
Privilege : {System.Anonymous, System.View}
&lt;/pre&gt; &lt;br /&gt;VI comes with a number of pre-defined roles.&lt;br /&gt;These pre-defined roles all have a negative &lt;b&gt;RoleId&lt;/b&gt; number and cannot be changed.&lt;br /&gt; &lt;br /&gt;To see the privileges that are grouped under a specific role you could do&lt;br /&gt; &lt;br /&gt;&lt;pre&gt;
PS C:\&amp;gt; Get-TkeRoles | where {$_.Name -eq &amp;quot;ReadOnly&amp;quot;} | select -ExpandProperty Privilege
System.Anonymous
System.Read
System.View
&lt;/pre&gt; &lt;br /&gt;but there is a specific advanced function to do just that&lt;br /&gt;&lt;pre&gt;
PS C:\&amp;gt; Get-TkeRolePrivileges -name &amp;quot;readonly&amp;quot;
 
Name                                                          OnParent privGroupName                      privId
----                                                          -------- -------------                      ------
Anonymous                                                        False System                             System.Anonymous
View                                                             False System                             System.View
Read                                                             False System                             System.Read
&lt;/pre&gt; &lt;br /&gt;Note that the names of the roles do not always correspond literaly with the role names you see in the VI Client.&lt;br /&gt; &lt;br /&gt;To create a new role with a specific set of privileges you can do&lt;br /&gt; &lt;br /&gt;&lt;pre&gt;
PS C:\&amp;gt; New-TkeRole -name &amp;quot;My new role&amp;quot; -privIds &amp;quot;VirtualMachine.Interact.PowerOn&amp;quot;,&amp;quot;VirtualMachine.Interact.PowerOff&amp;quot;
110
&lt;/pre&gt; &lt;br /&gt;The advanced function returns the &lt;b&gt;roleId&lt;/b&gt; of the new role.&lt;br /&gt; &lt;br /&gt;&lt;b&gt;Note&lt;/b&gt; that the privilege Ids are case-sensitive !&lt;br /&gt; &lt;br /&gt;If you want to make changes to the privileges assigned to a user-defined role (remember, the roles with the positive roleId numbers) you can do&lt;br /&gt; &lt;br /&gt;&lt;pre&gt;
PS C:\&amp;gt; Set-TkeRole -name &amp;quot;My new role&amp;quot; -privIds &amp;quot;VirtualMachine.Interact.Suspend&amp;quot;
&lt;/pre&gt; &lt;br /&gt; &lt;br /&gt;The Set-TkeRol cmdlet has a parameter, called -append, which allows you to specify if the privileges need to be added (-append:$true) to the existing privileges or need to replace (-append:$false) the existing privileges.&lt;br /&gt; &lt;br /&gt;&lt;pre&gt;
PS C:\&amp;gt; Set-TkeRole -name &amp;quot;My new role&amp;quot; -privIds &amp;quot;VirtualMachine.Interact.Reset&amp;quot; -append:$true
&lt;/pre&gt; &lt;br /&gt; &lt;br /&gt;You can also change the name of a user-defined role&lt;br /&gt; &lt;br /&gt;&lt;pre&gt;
PS C:\&amp;gt; Set-TkeRole -name &amp;quot;My new role&amp;quot; -newName &amp;quot;A new name for the role&amp;quot;
&lt;/pre&gt; &lt;br /&gt; &lt;br /&gt;If a role becomes obsolete, you can remove it like this&lt;br /&gt; &lt;br /&gt;&lt;pre&gt;
PS C:\&amp;gt; Remove-TkeRole -name &amp;quot;A new name for the role&amp;quot;
&lt;/pre&gt; &lt;br /&gt;As a failsafe this cmdlet has a switch, called &lt;b&gt;-FailIfUsed&lt;/b&gt;, which prohibits the removal of the role if the role is used in a permission.&lt;br /&gt;The default for this switch is -FailIfUsed:$true.&lt;br /&gt; &lt;br /&gt;&lt;pre&gt;
PS C:\&amp;gt; Remove-TkeRole -name &amp;quot;A new name for the role&amp;quot; -FailIfUsed:$false
&lt;/pre&gt; &lt;br /&gt; &lt;br /&gt;Once you have the roles set up like you want, you can start assigning permissions.&lt;br /&gt; &lt;br /&gt;A permission can be used on practicaly all of the VI objects.&lt;br /&gt;As a guideline, if the object has a Permissions tab in the VI Client, you assign permissions to it.&lt;br /&gt; &lt;br /&gt;To set a permission, use the &lt;b&gt;Set-TkePermissions&lt;/b&gt; advanced function.&lt;br /&gt;The &lt;b&gt;-permission&lt;/b&gt; parameter accepts one or more (an array) &lt;a href="http://www.vmware.com/support/developer/vc-sdk/visdk25pubs/ReferenceGuide/vim.AuthorizationManager.Permission.html" class="externalLink"&gt;Permission&lt;span class="externalLinkIcon"&gt;&lt;/span&gt;&lt;/a&gt; object(s).&lt;br /&gt;See the API Reference guide for an explanation of the properties.&lt;br /&gt; &lt;br /&gt;In this example we assign the privileges, defined in the &lt;b&gt;ReadOnly&lt;/b&gt; role, to the user account &lt;b&gt;Test\Guest&lt;/b&gt;.&lt;br /&gt;The permission will only be applied to the object itself, not to any of it's cildren.&lt;br /&gt; &lt;br /&gt;&lt;pre&gt;
PS C:\&amp;gt; $MyPermission = New-Object VMware.Vim.Permission
PS C:\&amp;gt; $MyPermission.principal = &amp;quot;Test\Guest&amp;quot;
PS C:\&amp;gt; $MyPermission.group = $false
PS C:\&amp;gt; $myPermission.propagate = $false
PS C:\&amp;gt; $MyPermission.RoleId = (Get-TkeRoles | Where-Object {$_.Name -eq &amp;quot;ReadOnly&amp;quot;} | % {$_.RoleId})
PS C:\&amp;gt; Get-VM PC2 | Set-TkePermissions -permission $myPermission
PS C:\&amp;gt; Get-VM PC2 | Get-TkePermissions
 
Entity    : PC2
Group     : False
Principal : TEST\Guest
Propagate : False
Role      : ReadOnly
&lt;/pre&gt; &lt;br /&gt;The example also showed the use of the &lt;b&gt;Get-TkePermissions&lt;/b&gt; cmdlet.&lt;br /&gt;This will list all permissions that are set on a VI object.&lt;br /&gt; &lt;br /&gt;If you also want to see the permissions that were inherited for that object, you need to use the &lt;b&gt;-inherited&lt;/b&gt; parameter.&lt;br /&gt; &lt;br /&gt;&lt;pre&gt;
PS C:\&amp;gt; Get-VM PC2 | Get-TkePermissions -inherited:$true
 
 
Entity    : PC2
Group     : False
Principal : TEST\Guest
Propagate : False
Role      : ReadOnly
 
Entity    : Datacenters
Group     : True
Principal : TEST\Domain Admins
Propagate : True
Role      : Admin
&lt;/pre&gt; &lt;br /&gt;The removal of a permission is rather straight-forward.&lt;br /&gt; &lt;br /&gt;&lt;pre&gt;
PS C:\&amp;gt; Get-VM PC2 | Remove-TkePermissions -principal &amp;quot;Test\Guest&amp;quot;
&lt;/pre&gt; &lt;br /&gt;
&lt;/div&gt;</description><author>LucD</author><pubDate>Wed, 31 Dec 2008 17:53:04 GMT</pubDate><guid isPermaLink="false">Updated Wiki: examples 20081231055304P</guid></item><item><title>Updated Wiki: Home</title><link>http://www.codeplex.com/vitoolkitextensions/Wiki/View.aspx?title=Home&amp;version=5</link><description>&lt;div class="wikidoc"&gt;
&lt;b&gt;Project Description&lt;/b&gt;&lt;br /&gt;The VI Toolkit for Windows Community Extensions is a PowerShell module designed to work with the VI Toolkit for Windows &amp;#40;http&amp;#58;&amp;#47;&amp;#47;vmware.com&amp;#47;go&amp;#47;powershell&amp;#41;.&lt;br /&gt; &lt;br /&gt;&lt;b&gt;Project Goals&lt;/b&gt;&lt;br /&gt;This project aims to help make managing VMware products with PowerShell easy and really powerful. Our current &lt;a href="http://vmware.com/go/powershell" class="externalLink"&gt;VI Toolkit for Windows&lt;span class="externalLinkIcon"&gt;&lt;/span&gt;&lt;/a&gt; contains 125 cmdlets that makes life a lot easier for people who manage VMware ESX and VMware VirtualCenter. With this project we plan to build on that by providing libraries of really useful stuff based on the ideas we see in &lt;a href="http://communities.vmware.com/community/developer/windows_toolkit" class="externalLink"&gt;our VMware Community&lt;span class="externalLinkIcon"&gt;&lt;/span&gt;&lt;/a&gt; as well as plenty of ideas of our own.&lt;br /&gt; &lt;br /&gt;&lt;b&gt;How To Contribute&lt;/b&gt;&lt;br /&gt;We welcome your ideas and code contributions. Feel free to request features through the Discussions or Issue Tracker tab, or upload patches through the Source Code tab.&lt;br /&gt; &lt;br /&gt;&lt;b&gt;Guidelines For VI Toolkit Extensions Functions&lt;/b&gt;&lt;br /&gt;For tips on how to write a PowerShell advanced function that can be included in the Extensions, see &lt;a href="http://www.codeplex.com/vitoolkitextensions/Wiki/View.aspx?title=guidelines&amp;amp;referringTitle=Home"&gt;guidelines&lt;/a&gt;.&lt;br /&gt; &lt;br /&gt;&lt;b&gt;VI Toolkit Extensions examples&lt;/b&gt;&lt;br /&gt;For examples on how some of the advanced functions can be used see &lt;a href="http://www.codeplex.com/vitoolkitextensions/Wiki/View.aspx?title=examples&amp;amp;referringTitle=Home"&gt;examples&lt;/a&gt;.&lt;br /&gt;
&lt;/div&gt;</description><author>LucD</author><pubDate>Wed, 31 Dec 2008 12:28:44 GMT</pubDate><guid isPermaLink="false">Updated Wiki: Home 20081231122844P</guid></item><item><title>Updated Wiki: Home</title><link>http://www.codeplex.com/vitoolkitextensions/Wiki/View.aspx?title=Home&amp;version=4</link><description>&lt;div class="wikidoc"&gt;
&lt;b&gt;Project Description&lt;/b&gt;&lt;br /&gt;The VI Toolkit for Windows Community Extensions is a PowerShell module designed to work with the VI Toolkit for Windows &amp;#40;http&amp;#58;&amp;#47;&amp;#47;vmware.com&amp;#47;go&amp;#47;powershell&amp;#41;.&lt;br /&gt; &lt;br /&gt;&lt;b&gt;Project Goals&lt;/b&gt;&lt;br /&gt;This project aims to help make managing VMware products with PowerShell easy and really powerful. Our current &lt;a href="http://vmware.com/go/powershell" class="externalLink"&gt;VI Toolkit for Windows&lt;span class="externalLinkIcon"&gt;&lt;/span&gt;&lt;/a&gt; contains 125 cmdlets that makes life a lot easier for people who manage VMware ESX and VMware VirtualCenter. With this project we plan to build on that by providing libraries of really useful stuff based on the ideas we see in &lt;a href="http://communities.vmware.com/community/developer/windows_toolkit" class="externalLink"&gt;our VMware Community&lt;span class="externalLinkIcon"&gt;&lt;/span&gt;&lt;/a&gt; as well as plenty of ideas of our own.&lt;br /&gt; &lt;br /&gt;&lt;b&gt;How To Contribute&lt;/b&gt;&lt;br /&gt;We welcome your ideas and code contributions. Feel free to request features through the Discussions or Issue Tracker tab, or upload patches through the Source Code tab.&lt;br /&gt; &lt;br /&gt;&lt;b&gt;Guidelines For VI Toolkit Extensions Functions&lt;/b&gt;&lt;br /&gt;For tips on how to write a PowerShell advanced function that can be included in the Extensions, see &lt;a href="http://www.codeplex.com/vitoolkitextensions/Wiki/View.aspx?title=guidelines&amp;amp;referringTitle=Home"&gt;guidelines&lt;/a&gt;.&lt;br /&gt;
&lt;/div&gt;</description><author>cartershanklin</author><pubDate>Mon, 29 Dec 2008 23:34:57 GMT</pubDate><guid isPermaLink="false">Updated Wiki: Home 20081229113457P</guid></item></channel></rss>