Thursday, February 3, 2011

   VMware vSphere PowerCLI Blog http://blogs.vmware.com/vipowershell/ vSphere PowerCLI is the best tool for automating management and configuration of VMware vSphere. en-US Thu, 16 Dec 2010 01:48:10 -0800 http://www.typepad.com/  HA Cluster Improvements http://blogs.vmware.com/vipowershell/2010/12/ha-cluster-improvements.html http://blogs.vmware.com/vipowershell/2010/12/ha-cluster-improvements.html PowerCLI 4.1.1 introduces three new improvements for HA clusters: Ability to edit advanced HA cluster settings Cmdlet that retrieves the primary nodes of HA cluster Set of new properties that contain runtime HA information The first of the new features... <p>PowerCLI 4.1.1 introduces three new improvements for HA clusters: <ul> <li>Ability to edit advanced HA cluster settings</li> <li>Cmdlet that retrieves the primary nodes of HA cluster</li> <li>Set of new properties that contain runtime HA information</li> </ul> </p>  <p><strong>The first</strong> of the new features is the ability to edit the advanced settings of HA clusters. There are four new cmdlets that allow you to customize HA settings - Get-AdvancedSetting, New-AdvancedSetting, Set-AdvancedSetting, and Remove-AdvancedSetting.</p> <p>Let's see several simple actions with these cmdlets:</p> <ul> <li>Assign value to isolation address 0 on cluster with name TestCluster <pre><strong>New-AdvancedSetting –Entity TestCluster `    –Type ClusterHA `    –Name 'das.isolationAddress0' –Value '172.16.0.5'</strong> </pre> </li> <li>Get isolation address 0 for all clusters <pre><strong>Get-Cluster | `    Get-AdvancedSetting -Name 'das.isolationAddress0' | `    select @{ 'n'='ClusterName'; 'e' = { $_.Entity.Name }}, Value | `    ft -AutoSize</strong> ClusterName Value ----------- ----- TestCluster 172.16.0.5 </pre> </li> <li>This command returns all customized settings for a given cluster <pre><strong>Get-AdvancedSetting –Entity TestCluster</strong> </pre> </li> <li>Update the value of an existing advanced setting for all clusters. <pre><strong>Get-Cluster | Get-AdvancedSetting -Name 'das.isolationAddress0' | `    Set-AdvancedSetting –Value '172.16.0.6'</strong> </pre> </li> <li>Updating can be done also through the New-AdvancedSetting cmdlet and by using the –Force switch. This row adds a value or overrides the already assigned value. <pre><strong>New-AdvancedSetting –Entity TestCluster `    –Type ClusterHA `    –Name 'das.isolationAddress0' –Value '172.16.0.5' `    –Force</strong> </pre> </li> <li>Remove a specific customized setting for all clusters. <pre><strong>Get-Cluster | Get-AdvancedSetting -Name 'das.isolationAddress0' | `    Remove-AdvancedSetting</strong> </pre> </li> </ul> <p>You can refer to the vSphere Availability Guide for the full list of HA advanced settings.</p>  <!---------------------------------------->  <hr/>  <p><strong>The second</strong> improvement is represented by the Get-HAPrimaryVMHost commandlet. This commandlet returns a list of the primary nodes/hosts for a given cluster and it is really simple to use:</p> <ul> <li>Get the primary nodes of a cluster named TestCluster <pre><strong>Get-Cluster TestCluster | Get-HAPrimaryVMHost</strong></pre> </li> </ul>  <!---------------------------------------->  <hr/>  <p><strong>The third</strong> new feature is the addition of new properties in Cluster objects. These properties describe HA cluster runtime information and their names are <em>HATotalSlots, HAUsedSlots, HAAvailableSlots, HASlotCpuMhz, HASlotMemoryMb and HASlotNumVCpus.</em></p>  <p>For example, let's see how we can create a report that shows the count of total slots and the count of currently used and available slots.</p>  <ul> <pre><strong>Get-Cluster TestCluster | `    select Name,HATotalSlots,HAUsedSlots,HAAvailableSlots | `    ft –AutoSize</strong> Name         HATotalSlots HAUsedSlots HAAvailableSlots ----         ------------ ----------- ---------------- TestCluster           123          36               39 </pre> </ul>    Vitali Baruh Thu, 16 Dec 2010 01:48:10 -0800    Improved backward compatibility in PowerCLI 4.1.1 http://blogs.vmware.com/vipowershell/2010/12/improved-backward-compatibility-in-powercli-411.html http://blogs.vmware.com/vipowershell/2010/12/improved-backward-compatibility-in-powercli-411.html The new PowerCLI 4.1.1 has improved compatibility with scripts written for PowerCLI 4.0.1 and earlier. PowerCLI 4.1 moved cmdlet output types to new namespaces. This introduced incompatibility with scripts which depend on output types’ full namespace path. To negate the... <p>The new PowerCLI 4.1.1 has improved compatibility with scripts written for PowerCLI 4.0.1 and earlier.</p><p>PowerCLI 4.1 <a href="http://blogs.vmware.com/vipowershell/2010/07/output-type-changes-in-powercli-41.html" target="_blank">moved cmdlet output types to new namespaces</a>. This introduced incompatibility with scripts which depend on output types’ full namespace path. To negate the impact of the change and to enable a transition period in which scripts can use full references to both old and new namespaces, PowerCLI 4.1.1 includes additional set of types which reside in the old namespaces (“the old types”) and are implemented by types in the new namespaces.<br /><br />In practice, this means that code like:<br /><em>function BackupVM ([VMware.VimAutomation.Types.VirtualMachine] $myVM) { … }</em><br />and<br /><em>function BackupVM ([VMware.VimAutomation.Client20.VirtualMachineImpl] $myVM) { … }</em><br />works with PowerCLI 4.1.1 even though the correct (new) types are:<br /><em>function BackupVM ([VMware.VimAutomation.ViCore.Types.V1.Inventory.VirtualMachine] $myVM) { … }</em><br />and<br /><em>function BackupVM ([VMware.VimAutomation.ViCore.Impl.V1.Inventory.VirtualMachineImpl] $myVM) { … }</em></p><p>IMPORTANT: The described compatibility support is temporary. We plan to remove the old types in the release following 4.1.1. This means that no new scripts should be written based on the old types and legacy scripts should be updated to remove dependencies on the old types.</p><p>As always, it is advisable to avoid full namespace references where possible, and to reference types in the *.Types assemblies instead of their *.Impl counterparts.<br /><br />Andrey Anastasov,<br />PowerCLI architect</p>    Andrey Anastasov Fri, 10 Dec 2010 08:51:54 -0800    Enhanced Support for Distributed Switches in PowerCLI 4.1.1 http://blogs.vmware.com/vipowershell/2010/12/enhanced-support-for-distributed-switches-in-powercli-411.html http://blogs.vmware.com/vipowershell/2010/12/enhanced-support-for-distributed-switches-in-powercli-411.html Support for managing distributed switches was initially introduced in PowerCLI 4.1. In PowerCLI 4.1.1, we extend this functionality by making changes to the following cmdlets: Name Description Get-VirtualSwitch Returns both standard and distributed switches. You can filter the retrieved switches... <p>Support for managing distributed switches was initially introduced in PowerCLI 4.1. In PowerCLI 4.1.1, &#0160;we extend this functionality by making changes to the following cmdlets:</p> <table border="0" cellpadding="0" cellspacing="0" width="623"> <tbody> <tr> <td style="background: #4F81BD; border: solid #95B3D7 0.5pt;" width="150"> <div><span style="color: #ffffff;"><strong>Name</strong></span></div> </td> <td style="background: #4F81BD; border: solid #95B3D7 0.5pt;" width="473"> <div><span style="color: #ffffff;"><strong>Description</strong></span></div> </td> </tr> <tr> <td style="background: none repeat scroll 0% 0% #dbe5f1;" width="150"> <div>Get-VirtualSwitch</div> </td> <td style="background: #DBE5F1; border: solid #95B3D7 0.5pt;" width="473"> <div>Returns both standard and distributed switches. You can filter the retrieved switches by their type.</div> </td> </tr> <tr> <td style="border: solid #95B3D7 0.5pt;" width="150"> <div>Get-VirtualPortGroup</div> </td> <td style="border: solid #95B3D7 0.5pt;" width="473"> <div>Returns the virtual port groups of the specified standard and distributed switches.</div> </td> </tr> <tr> <td style="background: none repeat scroll 0% 0% #dbe5f1;" width="150"> <div>Get-VMHost</div> </td> <td style="background: #DBE5F1; border: solid #95B3D7 0.5pt;" width="473"> <div>You can retrieve the hosts that are connected to a specific distributed switch.</div> </td> </tr> <tr> <td style="border: solid #95B3D7 0.5pt;" width="150"> <div>Get-VM</div> </td> <td style="border: solid #95B3D7 0.5pt;" width="473"> <div>You can retrieve the virtual machines that are connected to a specific distributed switch.</div> </td> </tr> <tr> <td style="background: none repeat scroll 0% 0% #dbe5f1;" width="150"> <div>Get-VMHostNetworkAdapter</div> </td> <td style="background: #DBE5F1; border: solid #95B3D7 0.5pt;" width="473"> <div>You can retrieve the host network adapters that are connected to a specific distributed switch.</div> </td> </tr> <tr> <td style="border: solid #95B3D7 0.5pt;" width="150"> <div>New-NetworkAdapter, Set-NetworkAdapter</div> </td> <td style="border: solid #95B3D7 0.5pt;" width="473"> <div>You can attach network adapters to a specific Port Id of the distributed switch.</div> </td> </tr> </tbody> </table> <p>&#0160;</p> <p>By using PowerCLI cmdlets, you can migrate virtual machines and hosts between distributed virtual switches, and also create various reports related to distributed switches.</p> <p>Example:</p> <p>To list all distributed switches available in the vCenter Server, you can just run the Get-VirtualSwitch cmdlet:</p> <pre><strong><em>Get-VirtualSwitch -Distributed</em></strong></pre> <pre>Name         NumPorts   Num Ports  Mtu   Key                            Notes<br />                           Available<br />----         --------   ---------- ---   ---                            -----<br />dvSwitch     132                   1500  9d 2e 25 50 f4 63 6d 42-25 ... PowerCLI vDS<br /><br /></pre> <p>The port groups on the distributed switch are also easy to retrieve:</p> <pre><strong><em>Get-VirtualSwitch -Name dvSwitch | Get-VirtualPortGroup</em></strong></pre> <pre>Name                      Key                            VLanId PortBinding NumPorts<br />----                      ---                            ------ ----------- --------<br />dvPortGroup               dvportgroup-118                       Static      128<br />dvSwitch-DVUplinks-116    dvportgroup-117                       Static      4<br /><br /></pre> <p>If you need to get the hosts connected to the distributed switch, just filter them by using the Get-VMHost cmdlet:</p> <pre><strong><em>Get-VMHost -DistributedSwitch dvSwitch</em></strong></pre> <pre>Name            ConnectionState PowerState      Id CpuUsage CpuTotal  Memory  Memory<br />                                                        Mhz      Mhz UsageMB TotalMB<br />----            --------------- ----------      -- -------- -------- ------- -------<br />192.168.1.125   Connected       PoweredOn  ...t-63      101     3178     911    2047<br /><br /></pre> <p>Even more, you can check which host network adapters are connected to a specific distributed switch:</p> <pre><strong><em>Get-VMHostNetworkAdapter -DistributedSwitch dvSwitch | select  VMHost, Name, Mac, IP</em></strong></pre> <pre>VMHost                  Name                Mac                        IP<br />------                  ----                ---                        --<br />192.168.1.125           vmnic1              00:50:56:94:5f:3b<br />192.168.1.125           vmk0                00:50:56:94:18:5c          192.168.1.125<br /><br /><br /></pre> <p>To check which virtual machines are part of a distributed switch network, use the DistributedSwitch parameter of the Get-VM cmdlet:</p> <pre><strong><em>Get-VM -DistributedSwitch dvSwitch</em></strong></pre> <pre>Name                 PowerState Num CPUs Memory (MB)<br />----                 ---------- -------- -----------<br />Dvs_vm1              PoweredOn  1        4096<br /><br /></pre>    Yasen Kalchev Tue, 07 Dec 2010 01:25:13 -0800    Better Firmware management in PowerCLI 4.1.1 http://blogs.vmware.com/vipowershell/2010/12/better-firmware-management-in-powercli-411.html http://blogs.vmware.com/vipowershell/2010/12/better-firmware-management-in-powercli-411.html The latest release of PowerCLI brings us improvements in managing host firmware for ESXi hosts: 1. Backup functionality is moved to Get-VMHostFirmware cmdlet and the same is deprecated for Set-VMHostFirmware 2. You can now backup and restore firmware for more... <p>The latest release of PowerCLI brings us improvements in managing host firmware for ESXi hosts:</p> <p>1.&#0160;&#0160;&#0160; Backup functionality is moved to Get-VMHostFirmware cmdlet and the same is deprecated for Set-VMHostFirmware<br />2.&#0160;&#0160;&#0160; You can now backup and restore firmware for more than one host at once. In fact backup will store the host bundles in the specified folder using unique bundle name for each host. Restore will use the bundles from this folder and restore the configuration of the corresponding hosts<br /><br />Here are some examples:<br /><br /><strong><em># Get two hosts to update</em></strong><br /><em>$hostList = Get-VMHost -Name &lt;ESXi-hostname1&gt;, &lt;ESXi-hostname2&gt;</em><br /><br /><strong><em># Backup host firmware for the specified hosts</em></strong><br /><em>$hostList | Get-VMHostFirmware -BackupConfiguration -DestinationPath C:\StoredBundles</em><br /><br /><strong><em># Put hosts in maintenance mode in order to restore the firmware</em></strong><br /><em>$hostList | Set-VMHost -State &#39;Maintenance&#39;</em><br /><br /><strong><em># Restore firmware for the specified hosts</em></strong><br /><em>$hostList | Set-VMHostFirmware -Restore -SourcePath C:\StoredBundles -HostUser root -HostPassword &#39;pass&#39;</em></p> <p><br /><em>VMHost&#0160;&#0160;&#0160;&#0160;&#0160;&#0160;&#0160;&#0160;&#0160;&#0160;&#0160;&#0160;&#0160;&#0160; UploadUrl</em><br /><em>------&#0160;&#0160;&#0160;&#0160;&#0160;&#0160;&#0160;&#0160;&#0160;&#0160;&#0160;&#0160;&#0160;&#0160; ---------</em><br /><em>&lt;ESXi-hostname1&gt;&#0160;&#0160;&#0160;&#0160;&#0160;&#0160;&#0160; http:// &lt;ESXi-hostname1&gt;/tmp/configBundle.tgz</em><br /><em>&lt;ESXi-hostname2&gt;&#0160;&#0160;&#0160;&#0160;&#0160;&#0160;&#0160; http:// &lt;ESXi-hostname2&gt;/tmp/configBundle.tgz</em><br /><br />More details on host firmware functionality are available in the product help or <a href="http://www.vmware.com/support/developer/PowerCLI/" target="_blank" title="PowerCLI online help">PowerCLI online help</a>.</p>    Gospodin Gochkov Fri, 03 Dec 2010 00:20:53 -0800    Support for Virtual Machine SCSI Controllers in PowerCLI 4.1.1 http://blogs.vmware.com/vipowershell/2010/12/support-for-virtual-machine-scsi-controllers-in-powercli-411.html http://blogs.vmware.com/vipowershell/2010/12/support-for-virtual-machine-scsi-controllers-in-powercli-411.html If you’ve ever missed the ability to manage virtual SCSI controllers with PowerCLI, your problem is now solved. The latest PowerCLI release introduces a new group of cmdlets for getting, creating and updating SCSI controllers of virtual machines. You can... <p>If you’ve ever missed the ability to manage virtual SCSI controllers with PowerCLI, your problem is now solved. The latest PowerCLI release introduces a new group of cmdlets for getting, creating and updating SCSI controllers of virtual machines. You can choose between different SCSI controller types and between different SCSI bus sharing modes. You can also filter the SCSI controllers by several filters: virtual machines, virtual hard disks, templates and snapshots. Here are few examples of usage of the new cmdlets:</p> <p><em>Get-VM “VM” | Get-ScsiController</em><br />Retrieves the SCSI controllers of the specified virtual machine.</p> <p><em>New-ScsiController -HardDisk $hardDisk-Type VirtualBusLogic -BusSharingMode NoSharing</em><br />Creates VirtualBusLogic SCSI controller with no sharing support and attaches the specified virtual hard disk to it.</p> <p><em>Set-ScsiController -ScsiController $scsicontroller –Type VirtualLsiLogic -BusSharingMode Virtual</em><br />Updates an existing SCSI controller’s type and sharing mode.</p> <p>Besides, you can create a new hard disk by specifying an existing SCSI controller and change the SCSI controller of an existing hard disk. New-HardDisk and Set-HardDisk cmdlets are enhanced with a new “Controller” parameter that accepts objects returned by New\Set\Get-ScsiController cmdlets.</p> <p>Note that you won’t find a Remove- ScsiController cmdlet. The reason is that you cannot remove a SCSI controller used by at least one virtual hard disk. If a SCSI controller becomes unused&#0160;by any hard disk, it is automatically removed.</p> <p>For more details about the support for virtual machine SCSI controllers, check out the PowerCLI cmdlet reference and the online documentation.</p> <p>&#0160;</p>    Irina Nikolova Thu, 02 Dec 2010 23:36:26 -0800    ESXCLI now available through PowerCLI http://blogs.vmware.com/vipowershell/2010/12/esxcli-now-available-through-powercli.html http://blogs.vmware.com/vipowershell/2010/12/esxcli-now-available-through-powercli.html I’ll illustrate esxcli in PowerCLI with an example of how path selection policy can be set for specific storage array type plugin. As you may know, until now this action could be performed by the esxcli command line tool and... <p>I’ll illustrate esxcli in PowerCLI with an example of how path selection policy can be set for specific storage array type plugin. As you may know, until now this action could be performed by the esxcli command line tool and the call would look something like:</p> <p><em>&#0160;&#0160;&#0160;&#0160;esxcli nmp satp setdefaultpsp -psp VMW_PSP_RR -satp VMW_SATP_SYMM</em></p> <p>From this release the esxcli functionality is available directly through the PowerCLI. The only thing you have to do is to retrieve an EsxCli instance and then invoke any of its methods. So it will look like:</p> <p><em>&#0160;&#0160;&#0160;&#0160;$esxCli = Get-EsxCli –Server $myEsxConnection</em></p> <p><em>&#0160;&#0160;&#0160;&#0160;$esxCli.nmp.satp.setdefaultpsp(“VMW_PSP_RR”, “VMW_SATP_SYMM”)</em></p> <p>Note that you have to be connected directly to your ESX, in order to retrieve EsxCli instance (It won’t work with VMHost instances, retrieved from a VC).</p> <p>In the esxcli tool you have applications, which are grouped in namespaces. Those applications have commands. The same organization is preserved in PowerCLI – The EsxCli object contains the namespaces as properties. The namespace objects contain the applications as properties and finally the commands are methods of those application objects. It’s quite easy to get help for those methods. What you have to do is to call help method for some application object, specifying the name of the desired command method:</p> <p><em>&#0160;&#0160;&#0160;&#0160;$esxCli.nmp.satp.help(&quot;setdefaultpsp&quot;)</em><em>&#0160;</em></p> <p>You can also retrieve help for the entire application:</p> <p><em>&#0160;&#0160;&#0160;&#0160;$esxCli.nmp.satp.help()</em></p> <p>Note that this feature is experimental. This means that in future releases backward compatibility is not guarantied.</p> <p>If you’d like to take a deeper look in the PowerCLI’s esxcli interface, you can read this article: <a href="http://communities.vmware.com/docs/DOC-14148" target="_blank" title="ESXCLI in PowerCLI - overview">ESXCLI in PowerCLI - overview</a></p>    Pavel Dimitrov Thu, 02 Dec 2010 08:43:13 -0800    Managing vSphere Alarms with PowerCLI http://blogs.vmware.com/vipowershell/2010/12/managing-vsphere-alarms-with-powercli.html http://blogs.vmware.com/vipowershell/2010/12/managing-vsphere-alarms-with-powercli.html Greetings to all vSphere administrators out there! We are now going to take a look at a new functionality introduced in PowerCLI 4.1 Update 1 – namely vSphere alarms management. We assume that you are already familiar with the vSphere... <p>Greetings to all vSphere administrators out there! We are now going to take a look at a new functionality introduced in PowerCLI 4.1 Update 1 – namely vSphere alarms management. We assume that you are already familiar with the vSphere alarms functionality. For those of you who are not, here are some resources on the topic: <a href="http://www.vmware.com/pdf/vsphere4/r41/vsp_41_dc_admin_guide.pdf">vSphere Datacenter Administration Guide</a> (see Chapter 13 “Working with Alarms”).</p> <p>Here’s an excerpt from the VMware documentation – “Alarms are notifications that occur in response to selected events, conditions, and states that occur with objects in the inventory. … The vCenter Server system is configured with a set of predefined alarms that monitor clusters, hosts, datacenters, datastores, networks, and virtual machines.” The current PowerCLI 4.1 Update 1 release supports only modifying <strong>the predefined</strong> alarms that come with the installation of vCenter Server.</p> <p>The new cmdlets are:</p> <ul> <li>Get-AlarmDefinition</li> <li>Set-AlarmDefinition</li> <li>New-AlarmAction</li> <li>Get-AlarmAction</li> <li>Remove-AlarmAction</li> <li>New-AlarmActionTrigger</li> <li>Get-AlarmActionTrigger</li> <li>Remove-AlarmActionTrigger</li> </ul> <p>With the new cmdlets, you can modify: the alarm actions, the interval on which alarm actions repeat (if repeatable), the alarm names, the alarm descriptions, and whether the alarm is enabled or not. We’ll look at some examples of how we can use these alarm management cmdlets.</p> <p>Get-AlarmDefinition is a typical PowerCLI getter. It returns all the alarms defined on the vCenter Servers you’re connected to. There are also some optional parameters which allow you to filter the results by name, by the inventory object on which the alarm is defined, and by its state (enabled or disabled).</p> <p>Here are some examples:</p> <p>Get-AlarmDefinition # This will return all the defined alarms on the servers you’re connected to</p> <p>Get-AlarmDefinition -Name &quot;virtual machine*&quot; -Enabled $false # This will return all the disabled alarm definitions with names starting with “virtual machine”</p> <p>Get-VMHost hostname | Get-AlarmDefinition # This will return all alarms that apply to the host “hostname”. This includes alarms defined on this host and alarms inherited from the parent entity, or from any ancestors in the inventory hierarchy.</p> <p>Here’s how you can modify an alarm definition:</p> <p>Get-AlarmDefinition &quot;Host memory status&quot; | Set-AlarmDefinition -Name &quot;Host memory&quot; -Enabled $false # This will rename the alarm to “Host memory” and disable it</p> <p>The main part of the alarm definitions you can manage is an alarm’s actions configuration. You can create an alarm action this way:</p> <p>Get-AlarmDefinition &quot;Host storage status&quot; | New-AlarmAction -Email -To “<a href="mailto:me@mycompany.com">me@mycompany.com</a>” -Subject &quot;Host storage shortage&quot; # This will create a send email action which will be triggered once when the alarm state changes from warning (yellow) to alert (red)</p> <p>Here is how you can add another action trigger, which will fire earlier – when the alarm state changes from normal (green) to alert (yellow):</p> <p>$action = Get-AlarmDefinition &quot;Host storage status&quot; | Get-AlarmAction -ActionType SendEmail # Get the action we previously created</p> <p>$action | New-AlarmActionTrigger -StartStatus Green -EndStatus Yellow –Repeat # Add a new repeating trigger to the action</p> <p>You can also set the interval at which the action is repeated:</p> <p>Set-AlarmDefinition &quot;Host storage status&quot; -ActionRepeatMinutes (60 * 24) # This will configure the send email action to repeat once a day (as long as the alarm is in the yellow state)</p> <p>Finally you may want to remove certain alarm actions. You can do it this way:</p> <p>$action = Get-AlarmDefinition &quot;Host storage status&quot; | Get-AlarmAction -ActionType SendEmail</p> <p>Remove-AlarmAction -AlarmAction $action</p> <p>This is what you can do with the newly introduced cmdlets. The PowerCLI team has decided that the rest of the alarm functionality will not be reconfigured often enough to add cmdlets for the task. However you can always gain full control over the situation through the alarm’s View object. Here’s how you can change alarm configuration that is not available to change through the cmdlets:</p> <p># Get the alarm’s view</p> <p>$alarmDefinition = Get-AlarmDefinition &quot;Host storage status&quot;</p> <p>$alarmSpecification = $alarmDefinition. ExtensionData</p> <p># Make the desired alarm configuration changes</p> <p>$alarmSpecification. Description=&quot;advanced-set description…..”</p> <p># Some other changes to the alarm configuration specification (for questions see the <a href="http://www.vmware.com/support/developer/vc-sdk/visdk41pubs/ApiReference/index.html">vSphere API Reference</a>)</p> <p>…</p> <p># Update the alarm</p> <p>$alarmView = Get-View $alarmSpecification.Alarm</p> <p>$alarmView.ReconfigureAlarm( $alarmSpecification )</p> <p>&#0160;</p> <p>Best regards,</p> <p>-Angel Evrov, MTS at VMware</p> <p>&#0160;</p> <p>&#0160;</p> <p>&#0160;</p>    nnedev Thu, 02 Dec 2010 07:16:15 -0800    ESXTOP Available Through PowerCLI http://blogs.vmware.com/vipowershell/2010/12/esxtop-available-through-powercli.html http://blogs.vmware.com/vipowershell/2010/12/esxtop-available-through-powercli.html PowerCLI 4.1.1 introduces the new Get-EsxTop cmdlet. This cmdlet provides functionality similar to the “esxtop” utility. The cmdlet allows you to access a wide variety of stats for your virtual environment – thus allowing you to create even more versatile... <p>PowerCLI 4.1.1 introduces the new <a href="http://www.vmware.com/support/developer/PowerCLI/PowerCLI41U1/html/Get-EsxTop.html">Get-EsxTop</a> cmdlet. This cmdlet provides functionality similar to the “esxtop” utility. The cmdlet allows you to access a wide variety of stats for your virtual environment – thus allowing you to create even more versatile reports using PowerCLI.</p> <p>There are 3 types of data returned by the cmdlet – counter information, topology information, and statistical data. The counter information shows you the available counters on your ESX as well as their properties (metadata information). To list all available counters you can simply do:</p> <p style="padding-left: 30px;"><em>Get-EsxTop –Counter</em><br /> <em># &nbsp;View the fields available for VCPU counter:</em><br /> <em>(Get-EsxTop –Counter –CounterName VCPU).Fields</em></p> <p>The topology information contains either inventory data that does not change (e.g. physical CPU information) or a counter instance structure describing the relationship between different counters. To list all available topologies, run:</p> <p style="padding-left: 30px;"><em>Get-EsxTop –TopologyInfo</em><br /> <em># View the entries of a specific topology:</em><br /> <em>(Get-EsxTop –TopologyInfo –Topology SchedGroup).Entries | Format-Table</em></p> <p>Finally the statistical data gives you the actual values for the available counters:</p> <p style="padding-left: 30px;"><em># Retrieve the counter values for “VCPU” and “SchedGroup" counters:</em><br /> <em>Get-EsxTop –CounterName VCPU | Format-Table * -AutoSize</em><br /> <em>Get-EsxTop –CounterName SchedGroup | Format-Table * -AutoSize</em></p> <p>You can use these three sources to navigate the esxtop information and build your reports.</p> <p>Get-EsxTop works on ESX 4.0 or newer. The cmdlet is dynamic in its nature, meaning that the returned values may differ between ESX versions and the actual data returned is appended as PowerShell dynamic properties to the output objects. Please note that the cmdlet is currently experimental and its output may change in future PowerCLI versions.</p>    Dimitar Hristov Thu, 02 Dec 2010 07:04:48 -0800    PowerCLI 4.1.1 is out http://blogs.vmware.com/vipowershell/2010/12/powercli-411-is-out.html http://blogs.vmware.com/vipowershell/2010/12/powercli-411-is-out.html Tonight we released PowerCLI 4.1.1. Feature Highlights: ESXCLI functionality is now available directly through a new Get-EsxCli cmdlet Esxtop statistics through a Get-EsxTop cmdlet Enhanced vDS support Support for vCenter Server alarms Various host storage enhancements Encrypted credential store The... <p>Tonight we released <a href="http://downloads.vmware.com/downloads/download.do?downloadGroup=SDKWIN41U1">PowerCLI 4.1.1</a>. <br /></p><b>Feature Highlights:</b> <ul> <li>ESXCLI functionality is now available directly through a new Get-EsxCli cmdlet</li> <li>Esxtop statistics through a Get-EsxTop cmdlet</li> <li>Enhanced vDS support</li> <li>Support for vCenter Server alarms</li> <li>Various host storage enhancements</li> <li>Encrypted credential store</li> </ul> <p>The complete change log is available <a href="http://www.vmware.com/support/developer/PowerCLI/changelog.html#PowerCLI41U1">here</a>. <br />In the next few weeks we’ll present the most exciting new features with specific posts so stay tuned. In the meantime don’t forget to download and try the <a href="http://downloads.vmware.com/downloads/download.do?downloadGroup=SDKWIN41U1">new release</a>.</p>    Andrey Anastasov Thu, 02 Dec 2010 06:14:53 -0800    Managing vSphere Permissions with PowerCLI http://blogs.vmware.com/vipowershell/2010/11/managing-vsphere-permissions-with-powercli.html http://blogs.vmware.com/vipowershell/2010/11/managing-vsphere-permissions-with-powercli.html vCenter Server and ESX/ESXi hosts determine the level of access for the user by reading the permissions that are assigned to the user. The combination of user name, password, and permissions authorizes the user to perform activities on vSphere server... <p>vCenter Server and ESX/ESXi hosts determine the level of access for the user by reading the permissions that are assigned to the user. The combination of user name, password, and permissions authorizes the user to perform activities on vSphere server objects.</p> <p>PowerCLI 4.0 U1 introduced a full set of cmdlets for managing vSphere permissions:</p> <table border="0" cellpadding="0" cellspacing="0" width="623"> <tbody> <tr> <td style="background: #4F81BD; border: solid #95B3D7 0.5pt;" width="150"> <div><span style="color: #ffffff;"><strong>Name</strong></span></div> </td> <td style="background: #4F81BD; border: solid #95B3D7 0.5pt;" width="473"> <div><span style="color: #ffffff;"><strong>Description</strong></span></div> </td> </tr> <tr> <td style="border: solid #95B3D7 0.5pt;" width="150"> <div><span style="color: #111111;"><a href="http://www.vmware.com/support/developer/PowerCLI/PowerCLI41/html/Get-VIPermission.html">Get-VIPermission</a></span></div> </td> <td style="background: #DBE5F1; border: solid #95B3D7 0.5pt;" width="473"> <div>Retrieves the permissions defined on the specified inventory objects</div> </td> </tr> <tr> <td style="border: solid #95B3D7 0.5pt;" width="150"> <div><a href="http://www.vmware.com/support/developer/PowerCLI/PowerCLI41/html/New-VIPermission.html">New-VIPermission</a></div> </td> <td style="border: solid #95B3D7 0.5pt;" width="473"> <div>Creates new permissions on the specified inventory objects for the provided users and groups in the role.</div> </td> </tr> <tr> <td style="border: solid #95B3D7 0.5pt;" width="150"> <div><a href="http://www.vmware.com/support/developer/PowerCLI/PowerCLI41/html/Set-VIPermission.html">Set-VIPermission</a></div> </td> <td style="background: #DBE5F1; border: solid #95B3D7 0.5pt;" width="473"> <div>Modifies the properties of the specified permissions.</div> </td> </tr> <tr> <td style="border: solid #95B3D7 0.5pt;" width="150"> <div><a href="http://www.vmware.com/support/developer/PowerCLI/PowerCLI41/html/Remove-VIPermission.html">Remove-VIPermission</a></div> </td> <td style="border: solid #95B3D7 0.5pt;" width="473"> <div>Removes the specified permissions.</div> </td> </tr> <tr> <td style="border: solid #95B3D7 0.5pt;" width="150"> <div><a href="http://www.vmware.com/support/developer/PowerCLI/PowerCLI41/html/Get-VIRrivilege.html">Get-VIPrivilege</a></div> </td> <td style="background: #DBE5F1; border: solid #95B3D7 0.5pt;" width="473"> <div>Retrieve the privilege groups and items for the provided servers.</div> </td> </tr> <tr> <td style="border: solid #95B3D7 0.5pt;" width="150"> <div><a href="http://www.vmware.com/support/developer/PowerCLI/PowerCLI41/html/Get-VIRole.html">Get-VIRole</a></div> </td> <td style="border: solid #95B3D7 0.5pt;" width="473"> <div>Retrieves all roles defined on the provided servers.</div> </td> </tr> <tr> <td style="border: solid #95B3D7 0.5pt;" width="150"> <div><a href="http://www.vmware.com/support/developer/PowerCLI/PowerCLI41/html/New-VIRole.html">New-VIRole</a></div> </td> <td style="background: #DBE5F1; border: solid #95B3D7 0.5pt;" width="473"> <div>Creates a new role on the specified servers and applies the provided privileges.</div> </td> </tr> <tr> <td style="border: solid #95B3D7 0.5pt;" width="150"> <div><a href="http://www.vmware.com/support/developer/PowerCLI/PowerCLI41/html/Set-VIRole.html">Set-VIRole</a></div> </td> <td style="border: solid #95B3D7 0.5pt;" width="473"> <div>Modifies the privileges of the provided roles.</div> </td> </tr> <tr> <td style="border: solid #95B3D7 0.5pt;" width="150"> <div><a href="http://www.vmware.com/support/developer/PowerCLI/PowerCLI41/html/Remove-VIRole.html">Remove-VIRole</a></div> </td> <td style="background: #DBE5F1; border: solid #95B3D7 0.5pt;" width="473"> <div>Removes the specified roles.</div> </td> </tr> </tbody> </table> <p><br />By using these cmdlets, you can fully automate the setup of vSphere permissions.</p> <p>The example below shows a sample scenario how to create a custom role and set permissions to a user.</p> <p>First, you can get the privileges of the read-only role. A role is a predefined set of privileges. Privileges define basic individual rights required to perform actions and read properties.</p> <pre><span style="background-color: #e6e6e6;">$readOnlyPrivileges = Get-VIPrivilege -Role readonly </span></pre> <p>To create a new role with custom privileges, use <em>New-VIRole</em>.</p> <pre><span style="background-color: #e6e6e6;">$myRole = New-VIRole -Privilege $readOnlyPrivileges -Name MyRole </span></pre> <p>You can check the list of roles on the server including newly created role:</p> <pre><span style="background-color: #e6e6e6;">Get-VIRole</span></pre> <p>If you want to add more privileges to the newly created role just use the Set-VIRole cmdlet:</p> <pre><span style="background-color: #e6e6e6;">$powerOnPrivileges = Get-VIPrivilege -Name &quot;Power On&quot; </span><br /><span style="background-color: #e6e6e6;">$myRole = Set-VIRole –Role $myRole –AddPrivilege $powerOnPrivileges</span></pre> <p>The privileges on the updated role can be examined by using <em>Get-VIPrivilege</em> with the <em>Role </em>parameter:</p> <pre><span style="background-color: #e6e6e6;">Get-VIPrivilege -Role $myRole</span></pre> <p>We already have a custom created role, so we can grant a permission to a user. We’ll apply permissions to a vSphere root object and propagate them across the hierarchy:</p> <pre><span style="background-color: #e6e6e6;">$rootFolder = Get-Folder -NoRecursion</span><br /><span style="background-color: #e6e6e6;">$myPermission = New-VIPermission -Entity $rootFolder -Principal &quot;myuser&quot; -Role readonly -Propagate:$true</span></pre> <p>Note that the Principal parameter supports local users and groups as well as domain users/groups if the vSphere server is joined in AD.</p> <p>As you noticed, we’ve granted a read-only permission, so we need to update <em>Role </em>of the newly created permission with our custom role:</p> <pre><span style="color: #111111; background-color: #e6e6e6;">$myPermission = Set-VIPermission -Permission $myPermission -Role $myRoleRemove permission</span></pre> <p>These are the simple steps how to create a new role and grant permissions to a user.</p> <p>If you want to remove permission, you can just use the <em>Remove-VIPermission</em> cmdlet</p> <pre><span style="background-color: #e6e6e6;">Remove-VIPermission $myPermission</span></pre> <p>and<em> Remove-VIRole</em> to remove your custom role:</p> <pre><span style="background-color: #e6e6e6;">Remove-VIRole MyRole</span></pre>   vCenter  Yasen Kalchev Wed, 24 Nov 2010 01:08:03 -0800