<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:clearspace="http://www.jivesoftware.com/xmlns/clearspace/rss" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:wfw="http://wellformedweb.org/CommentAPI/" xmlns:opensearch="http://a9.com/-/spec/opensearch/1.1/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>John Tuffin's Blog</title>
    <link>http://communities.vmware.com/blogs/cpqarray</link>
    <description>John Tuffin's Personal Log about E-Learning Course Development</description>
    <pubDate>Mon, 21 Jul 2008 20:29:34 GMT</pubDate>
    <generator>Clearspace 1.10.12 (http://jivesoftware.com/products/clearspace/)</generator>
    <dc:date>2008-07-21T20:29:34Z</dc:date>
    <item>
      <title>Get-stat</title>
      <link>http://communities.vmware.com/blogs/cpqarray/2008/07/21/getstat</link>
      <description>I've been playing around with the get-stat command. Thanks a bunch to Brian Denicola at &lt;a class="jive-link-external" href="http://www.bjd145.org/labels/vmware%20powershell.html"&gt;http://www.bjd145.org/labels/vmware%20powershell.html&lt;/a&gt; for posting the example. &lt;br /&gt;
&lt;br /&gt;
To grab memory stats from an ESX host type the command get-stat $esx -Memory -maxsamples 3 -realtime this will grab 3 memory samples from the server $esx. &lt;br /&gt;
&lt;p /&gt;
For example &lt;br /&gt;
&lt;p /&gt;
&lt;blockquote&gt;$vc = get-viserver myvcserver -username admin -password vmware &lt;br clear="all" /&gt;	$esx = get-vmhost MyEsxServer &lt;br clear="all" /&gt;	$get-stat $esx -Memory -maxsamples 3 -realtime&lt;/blockquote&gt;
The -common switch gives averages for all major hardware subsystems cpu,memory, disk, and networking.&lt;br /&gt;
&lt;br /&gt;
&lt;blockquote&gt;$get-stat $esx -common -maxsamples 1 -realtime&lt;/blockquote&gt;
There is also a way to pull individual counters provided that you know the counter name&lt;br /&gt;
&lt;br /&gt;
&lt;blockquote&gt;get-stat $esx -stat cpu.usagemhz.average&lt;/blockquote&gt;
This returns the average cpu usage in MHZ over the interval of collection. The list of all counters can be found here:&lt;br /&gt;
&lt;br /&gt;
&lt;a class="jive-link-external" href="http://www.vmware.com/support/developer/vc-sdk/visdk25pubs/visdk25programmingguide.pdf"&gt;http://www.vmware.com/support/developer/vc-sdk/visdk25pubs/visdk25programmingguide.pdf&lt;/a&gt;</description>
      <pubDate>Mon, 21 Jul 2008 20:53:00 GMT</pubDate>
      <author>cpqarray</author>
      <guid>http://communities.vmware.com/blogs/cpqarray/2008/07/21/getstat</guid>
      <dc:date>2008-07-21T20:53:00Z</dc:date>
      <clearspace:dateToText>1 year, 4 months ago</clearspace:dateToText>
      <wfw:comment>http://communities.vmware.com/blogs/cpqarray/comment/getstat</wfw:comment>
      <wfw:commentRss>http://communities.vmware.com/blogs/cpqarray/feeds/comments?blogPostID=1958</wfw:commentRss>
    </item>
    <item>
      <title>Changing the boot order of a Virtual Machine</title>
      <link>http://communities.vmware.com/blogs/cpqarray/2008/05/27/changing-the-boot-order-of-a-virtual-machine</link>
      <description>&lt;br /&gt;
This is cool becasue so often I've wanted to modify the boot order of a virtual machine and this little bit of code allows you to do it.  I can't remember where I found it now so I can't give credit but thanks to the poster that put this up in the forums. &lt;br /&gt;
&lt;p /&gt;
&lt;p /&gt;
&lt;p /&gt;
&lt;p /&gt;
&lt;p /&gt;
$spec = New-Object VMware.Vim.VirtualMachineConfigSpec $spec.extraConfig += New-Object VMware.Vim.OptionValue $spec.extraConfig[0].key = "bios.bootDeviceClasses" $spec.extraConfig[0].value = "allow:cd,hd" (get-view (Get-VM -Name &amp;lt;VM-name&amp;gt;).ID).ReconfigVM_Task($spec)</description>
      <pubDate>Tue, 27 May 2008 13:03:00 GMT</pubDate>
      <author>cpqarray</author>
      <guid>http://communities.vmware.com/blogs/cpqarray/2008/05/27/changing-the-boot-order-of-a-virtual-machine</guid>
      <dc:date>2008-05-27T13:03:00Z</dc:date>
      <clearspace:dateToText>1 year, 6 months ago</clearspace:dateToText>
      <wfw:comment>http://communities.vmware.com/blogs/cpqarray/comment/changing-the-boot-order-of-a-virtual-machine</wfw:comment>
      <wfw:commentRss>http://communities.vmware.com/blogs/cpqarray/feeds/comments?blogPostID=1746</wfw:commentRss>
    </item>
    <item>
      <title>Query ESX Time</title>
      <link>http://communities.vmware.com/blogs/cpqarray/2008/05/14/query-esx-time</link>
      <description>If you're not reading the forum for the VMware VI Toolkit Beta you are missing out on just a goldmine of useful information. Take this post from LUCD. This will allow you to query the ESX host for it's current time. This another one of those instances where there is no applet in the toolkit to do this so you hook into the API to get the information. &lt;br /&gt;
&lt;p /&gt;
Get-VIServer -Server  &amp;lt;Replace with yourServer Name&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;a class="jive-link-external" href="http://reflection.assembly/"&gt;http://Reflection.Assembly&lt;/a&gt;::LoadWithPartialName("vmware.vim")&lt;br /&gt;
&lt;br /&gt;
$svcRef = &lt;b&gt;new-object&lt;/b&gt; VMware.Vim.ManagedObjectReference &lt;br /&gt;
&lt;p /&gt;
$svcRef.Type = "ServiceInstance" &lt;br /&gt;
&lt;p /&gt;
$svcRef.Value = "ServiceInstance" &lt;br /&gt;
&lt;p /&gt;
$serviceInstance = &lt;b&gt;get-view&lt;/b&gt; $svcRef&lt;br /&gt;
&lt;p /&gt;
$datetime = $serviceInstance.ServerClock&lt;br /&gt;
&lt;br /&gt;
*&lt;br /&gt;
Write-Host $datetime&lt;br /&gt;
&lt;br /&gt;
*</description>
      <pubDate>Wed, 14 May 2008 22:27:00 GMT</pubDate>
      <author>cpqarray</author>
      <guid>http://communities.vmware.com/blogs/cpqarray/2008/05/14/query-esx-time</guid>
      <dc:date>2008-05-14T22:27:00Z</dc:date>
      <clearspace:dateToText>1 year, 6 months ago</clearspace:dateToText>
      <wfw:comment>http://communities.vmware.com/blogs/cpqarray/comment/query-esx-time</wfw:comment>
      <wfw:commentRss>http://communities.vmware.com/blogs/cpqarray/feeds/comments?blogPostID=1745</wfw:commentRss>
    </item>
    <item>
      <title>Moving VM's from One Switch to Another</title>
      <link>http://communities.vmware.com/blogs/cpqarray/2008/05/14/moving-vms-from-one-switch-to-another</link>
      <description>I found this example in the VMworld Europe presentation (excellent by the way) that would allow you to move a Virtual Machine from one virtual switch to another. &lt;br /&gt;
&lt;p /&gt;
&lt;p /&gt;
&lt;p /&gt;
get-vm vm1 | set-networkadapter "Production" &lt;br /&gt;
&lt;p /&gt;
Now say you wanted to move all vm's from the "VM Network" to "Production" &lt;br /&gt;
&lt;p /&gt;
get-vm | where { ($_ | get-networkadapter).NetworkName -eq"VM Network} | set-networkadapter -networkname "Production" &lt;br /&gt;
&lt;p /&gt;
This would move all VM's from the VM Network to Production. &lt;br /&gt;
&lt;p /&gt;
&lt;br /&gt;</description>
      <pubDate>Wed, 14 May 2008 22:20:00 GMT</pubDate>
      <author>cpqarray</author>
      <guid>http://communities.vmware.com/blogs/cpqarray/2008/05/14/moving-vms-from-one-switch-to-another</guid>
      <dc:date>2008-05-14T22:20:00Z</dc:date>
      <clearspace:dateToText>1 year, 6 months ago</clearspace:dateToText>
      <wfw:comment>http://communities.vmware.com/blogs/cpqarray/comment/moving-vms-from-one-switch-to-another</wfw:comment>
      <wfw:commentRss>http://communities.vmware.com/blogs/cpqarray/feeds/comments?blogPostID=1744</wfw:commentRss>
    </item>
    <item>
      <title>Using Powershell to Create a Simple VM</title>
      <link>http://communities.vmware.com/blogs/cpqarray/2008/04/25/using-powershell-to-create-a-simple-vm</link>
      <description>Here is how you can use PowerShell to create a virtual machine:&lt;br /&gt;
&lt;p /&gt;
&lt;p /&gt;
&lt;p /&gt;
get-vmhost ESX1 | new-vm -name `&lt;br /&gt;
&lt;p /&gt;
"First VM User N" -memorymb 256 `&lt;br /&gt;
&lt;p /&gt;
-diskmb 1024 -pool `&lt;br /&gt;
&lt;p /&gt;
(get-resourcepool studentN-esx1) `&lt;br /&gt;
&lt;p /&gt;
-location (get-folder studentN)</description>
      <pubDate>Fri, 25 Apr 2008 15:20:00 GMT</pubDate>
      <author>cpqarray</author>
      <guid>http://communities.vmware.com/blogs/cpqarray/2008/04/25/using-powershell-to-create-a-simple-vm</guid>
      <dc:date>2008-04-25T15:20:00Z</dc:date>
      <clearspace:dateToText>1 year, 7 months ago</clearspace:dateToText>
      <wfw:comment>http://communities.vmware.com/blogs/cpqarray/comment/using-powershell-to-create-a-simple-vm</wfw:comment>
      <wfw:commentRss>http://communities.vmware.com/blogs/cpqarray/feeds/comments?blogPostID=1699</wfw:commentRss>
    </item>
    <item>
      <title>Returning the Version of ESX with Powershell</title>
      <link>http://communities.vmware.com/blogs/cpqarray/2008/04/21/returning-the-version-of-esx-with-powershell</link>
      <description>Returning the product information about the ESX host with a simple command &lt;br /&gt;
&lt;br /&gt;
Get-VMHost | % { (Get-View $_.ID).Config.Product }</description>
      <pubDate>Mon, 21 Apr 2008 20:36:00 GMT</pubDate>
      <author>cpqarray</author>
      <guid>http://communities.vmware.com/blogs/cpqarray/2008/04/21/returning-the-version-of-esx-with-powershell</guid>
      <dc:date>2008-04-21T20:36:00Z</dc:date>
      <clearspace:dateToText>1 year, 7 months ago</clearspace:dateToText>
      <wfw:comment>http://communities.vmware.com/blogs/cpqarray/comment/returning-the-version-of-esx-with-powershell</wfw:comment>
      <wfw:commentRss>http://communities.vmware.com/blogs/cpqarray/feeds/comments?blogPostID=1682</wfw:commentRss>
    </item>
    <item>
      <title>Get-viserver Prompting for a User Name and Password</title>
      <link>http://communities.vmware.com/blogs/cpqarray/2008/04/21/getviserver-prompting-for-a-user-name-and-password</link>
      <description>Thanks to LucD on the forum for showing me this little trick today. To prompt for a username and password in get-viserver pass a -credentials argument to the command. For example &lt;br /&gt;
&lt;br /&gt;
get-viserver &amp;lt;Virtual Center Server Name&amp;gt; -Credentials (get-credential) &lt;br /&gt;
&lt;br /&gt;
that will prompt for a username and password rather than having to put it into the script. &lt;br /&gt;
&lt;p /&gt;
&lt;p /&gt;
&lt;p /&gt;</description>
      <pubDate>Mon, 21 Apr 2008 20:26:00 GMT</pubDate>
      <author>cpqarray</author>
      <guid>http://communities.vmware.com/blogs/cpqarray/2008/04/21/getviserver-prompting-for-a-user-name-and-password</guid>
      <dc:date>2008-04-21T20:26:00Z</dc:date>
      <clearspace:dateToText>1 year, 7 months ago</clearspace:dateToText>
      <wfw:comment>http://communities.vmware.com/blogs/cpqarray/comment/getviserver-prompting-for-a-user-name-and-password</wfw:comment>
      <wfw:commentRss>http://communities.vmware.com/blogs/cpqarray/feeds/comments?blogPostID=1681</wfw:commentRss>
    </item>
    <item>
      <title>Powershell returning a list of virtual machines and MAC Addresses</title>
      <link>http://communities.vmware.com/blogs/cpqarray/2008/04/17/powershell-returning-a-list-of-virtual-machines-and-mac-addresses</link>
      <description>I found this little bit code useful on the forums. It returns a list of virtual machines and their mac addresses.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;Get-VM | select name, @{Name="MAC"; expression={foreach($nic in (Get-View $_.ID).guest.net) {$nic.macAddress}}} &amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;p /&gt;
&lt;p /&gt;
&lt;p /&gt;
Note that the forums are putting the code tags in front of and at the end of the line of code.   That is not part of the actual code that you run in Powershell</description>
      <pubDate>Thu, 17 Apr 2008 17:05:00 GMT</pubDate>
      <author>cpqarray</author>
      <guid>http://communities.vmware.com/blogs/cpqarray/2008/04/17/powershell-returning-a-list-of-virtual-machines-and-mac-addresses</guid>
      <dc:date>2008-04-17T17:05:00Z</dc:date>
      <clearspace:dateToText>1 year, 7 months ago</clearspace:dateToText>
      <wfw:comment>http://communities.vmware.com/blogs/cpqarray/comment/powershell-returning-a-list-of-virtual-machines-and-mac-addresses</wfw:comment>
      <wfw:commentRss>http://communities.vmware.com/blogs/cpqarray/feeds/comments?blogPostID=1675</wfw:commentRss>
    </item>
    <item>
      <title>PowerShell and VMware Server</title>
      <link>http://communities.vmware.com/blogs/cpqarray/2008/04/08/powershell-and-vmware-server</link>
      <description>I just discovered that the Vmware VI Toolkit for Windows will work with VMware Server 2.0 Beta 2 as well with Virtual Infrastructure. I was able to connect with the command: &lt;br /&gt;
&lt;br /&gt;
get-viserver &amp;lt;VMware Server Name&amp;gt; -port 8333 -user &amp;lt;User Name&amp;gt; -password &amp;lt;Password&amp;gt; &lt;br /&gt;
&lt;p /&gt;
Then I was able to run the power commands as well as the new-snapshot command.</description>
      <pubDate>Tue, 08 Apr 2008 20:39:00 GMT</pubDate>
      <author>cpqarray</author>
      <guid>http://communities.vmware.com/blogs/cpqarray/2008/04/08/powershell-and-vmware-server</guid>
      <dc:date>2008-04-08T20:39:00Z</dc:date>
      <clearspace:dateToText>1 year, 7 months ago</clearspace:dateToText>
      <wfw:comment>http://communities.vmware.com/blogs/cpqarray/comment/powershell-and-vmware-server</wfw:comment>
      <wfw:commentRss>http://communities.vmware.com/blogs/cpqarray/feeds/comments?blogPostID=1648</wfw:commentRss>
    </item>
    <item>
      <title>Using PowerShell to place an ESX Host in Maintenance Mode</title>
      <link>http://communities.vmware.com/blogs/cpqarray/2008/04/03/using-powershell-to-place-an-esx-host-in-maintenance-mode</link>
      <description>I found this while surfing the forums this little bit of code will place an ESX Host in maintenance mode. I wonder what other values might exist for the -State switch? &lt;br /&gt;
&lt;p /&gt;
&lt;p /&gt;
&lt;p /&gt;
Get-VMHost -Name &amp;lt;hostname&amp;gt; | Set-VMHost -State maintenance</description>
      <pubDate>Thu, 03 Apr 2008 13:08:00 GMT</pubDate>
      <author>cpqarray</author>
      <guid>http://communities.vmware.com/blogs/cpqarray/2008/04/03/using-powershell-to-place-an-esx-host-in-maintenance-mode</guid>
      <dc:date>2008-04-03T13:08:00Z</dc:date>
      <clearspace:dateToText>1 year, 7 months ago</clearspace:dateToText>
      <clearspace:replyCount>1</clearspace:replyCount>
      <wfw:comment>http://communities.vmware.com/blogs/cpqarray/comment/using-powershell-to-place-an-esx-host-in-maintenance-mode</wfw:comment>
      <wfw:commentRss>http://communities.vmware.com/blogs/cpqarray/feeds/comments?blogPostID=1635</wfw:commentRss>
    </item>
    <item>
      <title>How to get a Datastore Report with PowerShell</title>
      <link>http://communities.vmware.com/blogs/cpqarray/2008/04/02/how-to-get-a-datastore-report-with-powershell</link>
      <description>This bit of code takes the output from Get-Datastore and converts it from megabytes to Gigabytes. It also labels the columms as FreespaceGB and CapacityGB.   This is from the forums as well.  &lt;br /&gt;
&lt;p /&gt;
&lt;p /&gt;
&lt;p /&gt;
&amp;lt;code&amp;gt;Get-Datastore | ft name,@{ Label = "FreespaceGB"; Expression = { $_.FreeSpaceMB * 1MB / 1GB } }, @{ Label = "CapacityGB"; Expression = { $_.CapacityMB * 1MB / 1GB } } &amp;lt;/code&amp;gt;</description>
      <pubDate>Wed, 02 Apr 2008 21:33:00 GMT</pubDate>
      <author>cpqarray</author>
      <guid>http://communities.vmware.com/blogs/cpqarray/2008/04/02/how-to-get-a-datastore-report-with-powershell</guid>
      <dc:date>2008-04-02T21:33:00Z</dc:date>
      <clearspace:dateToText>1 year, 7 months ago</clearspace:dateToText>
      <clearspace:replyCount>3</clearspace:replyCount>
      <wfw:comment>http://communities.vmware.com/blogs/cpqarray/comment/how-to-get-a-datastore-report-with-powershell</wfw:comment>
      <wfw:commentRss>http://communities.vmware.com/blogs/cpqarray/feeds/comments?blogPostID=1634</wfw:commentRss>
    </item>
    <item>
      <title>Creating a Virtual Switch with Powershell</title>
      <link>http://communities.vmware.com/blogs/cpqarray/2008/04/02/creating-a-virtual-switch-with-powershell</link>
      <description>This little snippet of PoweShell Code will create a virtual switch on an ESX Host. I found this while hunting through the VMware comunities for why I couldn't create a portgroup with Powershell. Using this code I was able to create a Virtual Switch called vSwitch1 with a VM portgroup called Production. I still have no idea what the policy setting does or do I know of any other values that could go there. &lt;br /&gt;
&lt;br /&gt;
$ESXhost = "sc-gallium04.pso.vmware.com"&lt;br /&gt;
&lt;br /&gt;
$vSwitch = "vSwitch1"&lt;br /&gt;
&lt;br /&gt;
$user = "scriptuser"&lt;br /&gt;
&lt;p /&gt;
$password = "vmware"&lt;br /&gt;
&lt;p /&gt;
$VC = "10.18.138.187"&lt;br /&gt;
&lt;br /&gt;
*&lt;br /&gt;
Get-VIServer $VC -User $user -Password $password&lt;br /&gt;
&lt;br /&gt;
*&lt;br /&gt;
&lt;br /&gt;
$NewSwitch = &lt;b&gt;New-VirtualSwitch&lt;/b&gt; &lt;i&gt;-vmhost&lt;/i&gt; (*Get-VMHost* $ESXhost ) &lt;i&gt;-Name&lt;/i&gt; $vSwitch &lt;i&gt;-NIC&lt;/i&gt; "vmnic1" &lt;br /&gt;
&lt;p /&gt;
$net = Get-View(Get-View(*Get-VMHost* &lt;i&gt;-Name&lt;/i&gt; $ESXHost).ID).configmanager.networksystem&lt;br /&gt;
&lt;p /&gt;
$PortgroupSpec = &lt;b&gt;New-Object&lt;/b&gt; vmware.Vim.hostportgroupspec&lt;br /&gt;
&lt;p /&gt;
$PortgroupSpec.vswitchname = $vSwitch&lt;br /&gt;
&lt;p /&gt;
$PortgroupSpec.Name = "Production" &lt;br /&gt;
&lt;p /&gt;
$PortgroupSpec.policy = &lt;b&gt;New-Object&lt;/b&gt; vmware.Vim.HostNetworkPolicy&lt;br /&gt;
&lt;p /&gt;
$net.AddPortgroup($PortGroupSpec)</description>
      <pubDate>Wed, 02 Apr 2008 20:33:00 GMT</pubDate>
      <author>cpqarray</author>
      <guid>http://communities.vmware.com/blogs/cpqarray/2008/04/02/creating-a-virtual-switch-with-powershell</guid>
      <dc:date>2008-04-02T20:33:00Z</dc:date>
      <clearspace:dateToText>1 year, 7 months ago</clearspace:dateToText>
      <wfw:comment>http://communities.vmware.com/blogs/cpqarray/comment/creating-a-virtual-switch-with-powershell</wfw:comment>
      <wfw:commentRss>http://communities.vmware.com/blogs/cpqarray/feeds/comments?blogPostID=1633</wfw:commentRss>
    </item>
    <item>
      <title>Using Powershell to Migrate a Virtual Machine</title>
      <link>http://communities.vmware.com/blogs/cpqarray/2008/03/28/using-powershell-to-migrate-a-virtual-machine</link>
      <description>These two lines of Powershell script are all you need to VMotion all virtual machines from one ESX host to another:&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;Get-VIServer&lt;/b&gt; 10.18.138.187 &lt;i&gt;-User&lt;/i&gt; "scriptuser" &lt;i&gt;-Password&lt;/i&gt; "vmware"&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;Get-VMHost&lt;/b&gt; sc-gallium07 | &lt;b&gt;Get-VM&lt;/b&gt; | &lt;b&gt;Move-VM&lt;/b&gt; &lt;i&gt;-Destination&lt;/i&gt; (*Get-vmhost* sc-gallium04)&lt;br /&gt;
&lt;p /&gt;
&lt;p /&gt;
&lt;p /&gt;
&lt;p /&gt;
&lt;p /&gt;
&lt;p /&gt;
&lt;br /&gt;
If you have Powershell and the VI-toolkit installed on a Windows box you run this little script and you have just scripted a VMotion.</description>
      <pubDate>Fri, 28 Mar 2008 14:24:00 GMT</pubDate>
      <author>cpqarray</author>
      <guid>http://communities.vmware.com/blogs/cpqarray/2008/03/28/using-powershell-to-migrate-a-virtual-machine</guid>
      <dc:date>2008-03-28T14:24:00Z</dc:date>
      <clearspace:dateToText>1 year, 7 months ago</clearspace:dateToText>
      <clearspace:replyCount>4</clearspace:replyCount>
      <wfw:comment>http://communities.vmware.com/blogs/cpqarray/comment/using-powershell-to-migrate-a-virtual-machine</wfw:comment>
      <wfw:commentRss>http://communities.vmware.com/blogs/cpqarray/feeds/comments?blogPostID=1613</wfw:commentRss>
    </item>
  </channel>
</rss>

