<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
		>
<channel>
	<title>Comments on: Add Custom Fields to VI Client with Powershell (Samples)</title>
	<atom:link href="http://www.peetersonline.nl/index.php/vmware/add-custom-fields-to-vi-client-with-powershell-samples/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.peetersonline.nl/index.php/vmware/add-custom-fields-to-vi-client-with-powershell-samples/</link>
	<description>Using Powershell for (virtually) everything!</description>
	<lastBuildDate>Fri, 27 Aug 2010 15:06:05 +0000</lastBuildDate>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0.1</generator>
	<item>
		<title>By: admin</title>
		<link>http://www.peetersonline.nl/index.php/vmware/add-custom-fields-to-vi-client-with-powershell-samples/comment-page-1/#comment-15568</link>
		<dc:creator>admin</dc:creator>
		<pubDate>Wed, 28 Apr 2010 14:50:22 +0000</pubDate>
		<guid isPermaLink="false">http://www.peetersonline.nl/?p=163#comment-15568</guid>
		<description>That&#039;s new since vSphere 4.0. Behind this line:
$fileQueryFlags.FileSize = $true
Add the following line:
$fileQueryFlags.FileOwner = $false

This tells the SearchDatastore method not to return file owners in the query.
Hugo</description>
		<content:encoded><![CDATA[<p>That&#8217;s new since <a href="http://www.vmware.com/products/vsphere/" target='_blank'>vSphere</a> 4.0. Behind this line:<br />
$fileQueryFlags.FileSize = $true<br />
Add the following line:<br />
$fileQueryFlags.FileOwner = $false</p>
<p>This tells the SearchDatastore method not to return file owners in the query.<br />
Hugo</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Michael</title>
		<link>http://www.peetersonline.nl/index.php/vmware/add-custom-fields-to-vi-client-with-powershell-samples/comment-page-1/#comment-15559</link>
		<dc:creator>Michael</dc:creator>
		<pubDate>Wed, 28 Apr 2010 06:51:02 +0000</pubDate>
		<guid isPermaLink="false">http://www.peetersonline.nl/?p=163#comment-15559</guid>
		<description>Hi there,
since our migation to vSphere i get the following error when i run your skript:

Exception calling &quot;SearchDatastoreSubFolders&quot; with &quot;2&quot; argument(s): &quot;Not initialized: boolean fileOwner&quot;
At :line:33 char:53
+ 	$searchResult = $dsBrowser.SearchDatastoreSubFolders &lt;&lt;&lt;&lt; ($SnapshotDirectory, $searchSpec)

You have any idea for me?

Best regards</description>
		<content:encoded><![CDATA[<p>Hi there,<br />
since our migation to <a href="http://www.vmware.com/products/vsphere/" target='_blank'>vSphere</a> i get the following error when i run your skript:</p>
<p>Exception calling &#8220;SearchDatastoreSubFolders&#8221; with &#8220;2&#8243; argument(s): &#8220;Not initialized: boolean fileOwner&#8221;<br />
At :line:33 char:53<br />
+ 	$searchResult = $dsBrowser.SearchDatastoreSubFolders &lt;&lt;&lt;&lt; ($SnapshotDirectory, $searchSpec)</p>
<p>You have any idea for me?</p>
<p>Best regards</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Methone</title>
		<link>http://www.peetersonline.nl/index.php/vmware/add-custom-fields-to-vi-client-with-powershell-samples/comment-page-1/#comment-10591</link>
		<dc:creator>Methone</dc:creator>
		<pubDate>Tue, 29 Sep 2009 07:15:11 +0000</pubDate>
		<guid isPermaLink="false">http://www.peetersonline.nl/?p=163#comment-10591</guid>
		<description>Hello !
thanks ! I tried it with cluster and it works. Is there also a way to fill the custom field for templates ?
Best regards</description>
		<content:encoded><![CDATA[<p>Hello !<br />
thanks ! I tried it with cluster and it works. Is there also a way to fill the custom field for templates ?<br />
Best regards</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: admin</title>
		<link>http://www.peetersonline.nl/index.php/vmware/add-custom-fields-to-vi-client-with-powershell-samples/comment-page-1/#comment-10589</link>
		<dc:creator>admin</dc:creator>
		<pubDate>Tue, 29 Sep 2009 05:42:19 +0000</pubDate>
		<guid isPermaLink="false">http://www.peetersonline.nl/?p=163#comment-10589</guid>
		<description>Hello Methone,
You can modify the line below # Fill Custom Fields to make sure only a few VMs or VMHosts are included. For instance:
$VMHosts = Get-VMHost -Location (Get-Cluster &quot;MyCluster&quot;)
or
$VMs = Get-VM -Location (Get-VMHost &quot;ESX12&quot;)

Hope this helps,
Hugo</description>
		<content:encoded><![CDATA[<p>Hello Methone,<br />
You can modify the line below # Fill Custom Fields to make sure only a few VMs or VMHosts are included. For instance:<br />
$VMHosts = Get-VMHost -Location (Get-Cluster &#8220;MyCluster&#8221;)<br />
or<br />
$VMs = Get-VM -Location (Get-VMHost &#8220;ESX12&#8243;)</p>
<p>Hope this helps,<br />
Hugo</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Methone</title>
		<link>http://www.peetersonline.nl/index.php/vmware/add-custom-fields-to-vi-client-with-powershell-samples/comment-page-1/#comment-10572</link>
		<dc:creator>Methone</dc:creator>
		<pubDate>Mon, 28 Sep 2009 16:05:12 +0000</pubDate>
		<guid isPermaLink="false">http://www.peetersonline.nl/?p=163#comment-10572</guid>
		<description>Hello ! Great Job,

how is it possible to determine in this script that the custom field is only changed for a special data center or cluster.

many thanks in advance.

best regards</description>
		<content:encoded><![CDATA[<p>Hello ! Great Job,</p>
<p>how is it possible to determine in this script that the custom field is only changed for a special data center or cluster.</p>
<p>many thanks in advance.</p>
<p>best regards</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Jack</title>
		<link>http://www.peetersonline.nl/index.php/vmware/add-custom-fields-to-vi-client-with-powershell-samples/comment-page-1/#comment-3592</link>
		<dc:creator>Jack</dc:creator>
		<pubDate>Fri, 10 Apr 2009 13:45:01 +0000</pubDate>
		<guid isPermaLink="false">http://www.peetersonline.nl/?p=163#comment-3592</guid>
		<description>Great Job, I am new to all of this scripting and love it. Your scripts are great. Just have a question, I put in the custom fields for total snapshots and snapshot size. When I view at a site location that shows all of my virtual machines the fields are not populated. When I drill down to a cluster level the fields are populated. Is ther another command I need to ad to populate at the site level?</description>
		<content:encoded><![CDATA[<p>Great Job, I am new to all of this scripting and love it. Your scripts are great. Just have a question, I put in the custom fields for total snapshots and snapshot size. When I view at a site location that shows all of my virtual machines the fields are not populated. When I drill down to a cluster level the fields are populated. Is ther another command I need to ad to populate at the site level?</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: admin</title>
		<link>http://www.peetersonline.nl/index.php/vmware/add-custom-fields-to-vi-client-with-powershell-samples/comment-page-1/#comment-2577</link>
		<dc:creator>admin</dc:creator>
		<pubDate>Wed, 18 Feb 2009 08:12:14 +0000</pubDate>
		<guid isPermaLink="false">http://www.peetersonline.nl/?p=163#comment-2577</guid>
		<description>&lt;a href=&quot;#comment-2557&quot; rel=&quot;nofollow&quot;&gt;@Glen &lt;/a&gt; 
$VM = Get-VM &quot;MY_VM&quot;
$VMView = $VM &#124; Get-View
$VMView.setCustomValue(&quot;My_CustomFieldName&quot;,&quot;My_NewValue&quot;)

The note field: Set-VM &quot;MY_VM&quot; -Description &quot;My_NewValue&quot;</description>
		<content:encoded><![CDATA[<p><a href="#comment-2557" rel="nofollow">@Glen </a><br />
$VM = Get-VM &#8220;MY_VM&#8221;<br />
$VMView = $VM | Get-View<br />
$VMView.setCustomValue(&#8220;My_CustomFieldName&#8221;,&#8221;My_NewValue&#8221;)</p>
<p>The note field: Set-VM &#8220;MY_VM&#8221; -Description &#8220;My_NewValue&#8221;</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Glen</title>
		<link>http://www.peetersonline.nl/index.php/vmware/add-custom-fields-to-vi-client-with-powershell-samples/comment-page-1/#comment-2557</link>
		<dc:creator>Glen</dc:creator>
		<pubDate>Tue, 17 Feb 2009 20:06:20 +0000</pubDate>
		<guid isPermaLink="false">http://www.peetersonline.nl/?p=163#comment-2557</guid>
		<description>I almost have this.. but what if I want to edit or place information in a custom field of a specific vm (TESTDPLY-VT01) where the custom field already exists. EX:
I have the custom fields named:
Application
Memory
Disk
How do I edit those...
I thought I had it..but I was wrong..
I am guessing the NOTE field is edited differently...
Thank you
Glen</description>
		<content:encoded><![CDATA[<p>I almost have this.. but what if I want to edit or place information in a custom field of a specific vm (TESTDPLY-VT01) where the custom field already exists. EX:<br />
I have the custom fields named:<br />
Application<br />
Memory<br />
Disk<br />
How do I edit those&#8230;<br />
I thought I had it..but I was wrong..<br />
I am guessing the NOTE field is edited differently&#8230;<br />
Thank you<br />
Glen</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: kdonofrio</title>
		<link>http://www.peetersonline.nl/index.php/vmware/add-custom-fields-to-vi-client-with-powershell-samples/comment-page-1/#comment-2542</link>
		<dc:creator>kdonofrio</dc:creator>
		<pubDate>Tue, 17 Feb 2009 01:09:46 +0000</pubDate>
		<guid isPermaLink="false">http://www.peetersonline.nl/?p=163#comment-2542</guid>
		<description>&lt;a href=&quot;#comment-2047&quot; rel=&quot;nofollow&quot;&gt;@admin &lt;/a&gt; 
that worked perfect, thank you very much</description>
		<content:encoded><![CDATA[<p><a href="#comment-2047" rel="nofollow">@admin </a><br />
that worked perfect, thank you very much</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: admin</title>
		<link>http://www.peetersonline.nl/index.php/vmware/add-custom-fields-to-vi-client-with-powershell-samples/comment-page-1/#comment-2047</link>
		<dc:creator>admin</dc:creator>
		<pubDate>Mon, 26 Jan 2009 10:38:52 +0000</pubDate>
		<guid isPermaLink="false">http://www.peetersonline.nl/?p=163#comment-2047</guid>
		<description>&lt;a href=&quot;#comment-1980&quot; rel=&quot;nofollow&quot;&gt;@kdonofrio &lt;/a&gt; 
#REMOVING A CUSTOM FIELD DEFINITION:
$VCServerName = &quot;MYVCSERVER&quot;
$CustomFieldName = &quot;LUNs&quot;
$VC = Connect-VIServer $VCServerName
$SI = Get-View ServiceInstance
$CFM = Get-View $SI.Content.CustomFieldsManager
$myCustomField = $CFM.Field &#124; Where {$_.Name -eq $CustomFieldName}
If ($myCustomField)
	{
	$CFM.RemoveCustomFieldDef($myCustomField.Key)
	}</description>
		<content:encoded><![CDATA[<p><a href="#comment-1980" rel="nofollow">@kdonofrio </a><br />
#REMOVING A CUSTOM FIELD DEFINITION:<br />
$VCServerName = &#8220;MYVCSERVER&#8221;<br />
$CustomFieldName = &#8220;LUNs&#8221;<br />
$VC = Connect-VIServer $VCServerName<br />
$SI = Get-View ServiceInstance<br />
$CFM = Get-View $SI.Content.CustomFieldsManager<br />
$myCustomField = $CFM.Field | Where {$_.Name -eq $CustomFieldName}<br />
If ($myCustomField)<br />
	{<br />
	$CFM.RemoveCustomFieldDef($myCustomField.Key)<br />
	}</p>
]]></content:encoded>
	</item>
</channel>
</rss>
