<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	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/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>PeetersOnline &#187; Oneliners</title>
	<atom:link href="http://www.peetersonline.nl/index.php/category/powershell/oneliners/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.peetersonline.nl</link>
	<description>Using Powershell for (virtually) everything!</description>
	<lastBuildDate>Fri, 19 Aug 2011 09:22:19 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.1</generator>
		<item>
		<title>Oneliner: Service Console IP with PowerCLI</title>
		<link>http://www.peetersonline.nl/index.php/vmware/oneliner-service-console-ip-with-powercli/</link>
		<comments>http://www.peetersonline.nl/index.php/vmware/oneliner-service-console-ip-with-powercli/#comments</comments>
		<pubDate>Tue, 26 May 2009 08:52:39 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Oneliners]]></category>
		<category><![CDATA[PowerCLI 4.0]]></category>
		<category><![CDATA[PowerShell]]></category>
		<category><![CDATA[VMware]]></category>
		<category><![CDATA[Oneliner]]></category>
		<category><![CDATA[PowerCLI]]></category>
		<category><![CDATA[Service Console]]></category>

		<guid isPermaLink="false">http://www.peetersonline.nl/?p=380</guid>
		<description><![CDATA[Getting the Service Console IP addresses of your ESX servers with vSphere PowerCLI (formerly known as the VI Toolkit for Powershell): Get-VMHost &#124; Select Name, @&#123;N=&#34;ConsoleIP&#34;;E=&#123;&#40;Get-VMHostNetwork&#41;.ConsoleNic &#124; ForEach&#123;$_.IP&#125;&#125;&#125; &#187;crosslinked&#171;Related posts: Calculate vSphere 5 Licenses with Powershell (UPDATED) Remove vmware memory limits with Powershell
Related posts:<ol>
<li><a href='http://www.peetersonline.nl/index.php/vmware/calculate-vsphere-5-licenses-with-powershell/' rel='bookmark' title='Calculate vSphere 5 Licenses with Powershell (UPDATED)'>Calculate vSphere 5 Licenses with Powershell (UPDATED)</a></li>
<li><a href='http://www.peetersonline.nl/index.php/vmware/remove-vmware-memory-limits-with-powershell/' rel='bookmark' title='Remove vmware memory limits with Powershell'>Remove vmware memory limits with Powershell</a></li>
</ol>]]></description>
			<content:encoded><![CDATA[<p>Getting the Service Console IP addresses of your ESX servers with <a href="http://www.vmware.com/products/vsphere/" target='_blank'>vSphere</a> <a href="http://communities.vmware.com/community/developer/windows_toolkit" target='_blank'>PowerCLI</a> (formerly known as the <a href="http://www.vmware.com/sdk/vitk_win/index.html" target='_blank'>VI Toolkit</a> for <a href="http://www.microsoft.com/windowsserver2003/technologies/management/powershell/default.mspx" target='_blank'>Powershell</a>):</p>

<div class="wp_syntax"><div class="code"><pre class="powershell" style="font-family:monospace;">Get<span style="color: pink;">-</span>VMHost <span style="color: pink;">|</span> <span style="color: #008080; font-weight: bold;">Select</span> Name<span style="color: pink;">,</span> <span style="color: pink;">@</span><span style="color: #000000;">&#123;</span>N<span style="color: pink;">=</span><span style="color: #800000;">&quot;ConsoleIP&quot;</span>;E<span style="color: pink;">=</span><span style="color: #000000;">&#123;</span><span style="color: #000000;">&#40;</span>Get<span style="color: pink;">-</span>VMHostNetwork<span style="color: #000000;">&#41;</span>.ConsoleNic <span style="color: pink;">|</span> <span style="color: #0000FF;">ForEach</span><span style="color: #000000;">&#123;</span><span style="color: #000080;">$_</span>.IP<span style="color: #000000;">&#125;</span><span style="color: #000000;">&#125;</span><span style="color: #000000;">&#125;</span></pre></div></div>

<p>Related posts:<ol>
<li><a href='http://www.peetersonline.nl/index.php/vmware/calculate-vsphere-5-licenses-with-powershell/' rel='bookmark' title='Calculate vSphere 5 Licenses with Powershell (UPDATED)'>Calculate vSphere 5 Licenses with Powershell (UPDATED)</a></li>
<li><a href='http://www.peetersonline.nl/index.php/vmware/remove-vmware-memory-limits-with-powershell/' rel='bookmark' title='Remove vmware memory limits with Powershell'>Remove vmware memory limits with Powershell</a></li>
</ol></p>]]></content:encoded>
			<wfw:commentRss>http://www.peetersonline.nl/index.php/vmware/oneliner-service-console-ip-with-powercli/feed/</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
		<item>
		<title>Checking VMware NTP configuration with Powershell</title>
		<link>http://www.peetersonline.nl/index.php/vmware/checking-vmware-ntp-configuration-with-powershell/</link>
		<comments>http://www.peetersonline.nl/index.php/vmware/checking-vmware-ntp-configuration-with-powershell/#comments</comments>
		<pubDate>Thu, 12 Feb 2009 08:37:44 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Oneliners]]></category>
		<category><![CDATA[PowerShell]]></category>
		<category><![CDATA[VI Toolkit 1.5]]></category>
		<category><![CDATA[VMware]]></category>
		<category><![CDATA[NTP]]></category>
		<category><![CDATA[Oneliner]]></category>
		<category><![CDATA[PowerCLI]]></category>
		<category><![CDATA[VI Toolkit]]></category>

		<guid isPermaLink="false">http://www.peetersonline.nl/?p=288</guid>
		<description><![CDATA[Thanks to the VMware VI Toolkit 1.5, checking the NTP settings on all your VMware ESX Servers is as easy as a oneliner: Get-VMHost &#124; Sort Name &#124; Select Name, @{N=&#8221;NTP&#8221;;E={Get-VMHostNtpServer $_}} Related posts: Remove vmware memory limits with Powershell Calculate vSphere 5 Licenses with Powershell (UPDATED)
Related posts:<ol>
<li><a href='http://www.peetersonline.nl/index.php/vmware/remove-vmware-memory-limits-with-powershell/' rel='bookmark' title='Remove vmware memory limits with Powershell'>Remove vmware memory limits with Powershell</a></li>
<li><a href='http://www.peetersonline.nl/index.php/vmware/calculate-vsphere-5-licenses-with-powershell/' rel='bookmark' title='Calculate vSphere 5 Licenses with Powershell (UPDATED)'>Calculate vSphere 5 Licenses with Powershell (UPDATED)</a></li>
</ol>]]></description>
			<content:encoded><![CDATA[<p>Thanks to the <a href="http://www.vmware.com/" target='_blank'>VMware</a> <a href="http://www.vmware.com/sdk/vitk_win/index.html" target='_blank'>VI Toolkit</a> 1.5, checking the NTP settings on all your <a href="http://www.vmware.com/" target='_blank'>VMware</a> ESX Servers is as easy as a oneliner:</p>
<blockquote><p>
Get-VMHost | Sort Name | Select Name, @{N=&#8221;NTP&#8221;;E={Get-VMHostNtpServer $_}}
</p></blockquote>
<p>Related posts:<ol>
<li><a href='http://www.peetersonline.nl/index.php/vmware/remove-vmware-memory-limits-with-powershell/' rel='bookmark' title='Remove vmware memory limits with Powershell'>Remove vmware memory limits with Powershell</a></li>
<li><a href='http://www.peetersonline.nl/index.php/vmware/calculate-vsphere-5-licenses-with-powershell/' rel='bookmark' title='Calculate vSphere 5 Licenses with Powershell (UPDATED)'>Calculate vSphere 5 Licenses with Powershell (UPDATED)</a></li>
</ol></p>]]></content:encoded>
			<wfw:commentRss>http://www.peetersonline.nl/index.php/vmware/checking-vmware-ntp-configuration-with-powershell/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>TOP 10 Commandlets in a Oneliner</title>
		<link>http://www.peetersonline.nl/index.php/powershell/top-10-commandlets-in-a-oneliner/</link>
		<comments>http://www.peetersonline.nl/index.php/powershell/top-10-commandlets-in-a-oneliner/#comments</comments>
		<pubDate>Thu, 18 Dec 2008 09:52:00 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Oneliners]]></category>
		<category><![CDATA[PowerShell]]></category>
		<category><![CDATA[cmdlets]]></category>
		<category><![CDATA[Fun]]></category>
		<category><![CDATA[Oneliner]]></category>

		<guid isPermaLink="false">http://www.peetersonline.nl/?p=188</guid>
		<description><![CDATA[&#8220;It&#8217;s the time for lists&#8221;, I read somewhere today. Sure, that is true. But blogging little lists isn&#8217;t much fun. So, I will let you generate your very own TOP 10 list. Use the following Powershell Oneliner to get a TOP 10 list of your most frequently used cmdlets in your scripts. (Remember to modify <a href='http://www.peetersonline.nl/index.php/powershell/top-10-commandlets-in-a-oneliner/'>[...]</a>
No related posts.]]></description>
			<content:encoded><![CDATA[<p>&#8220;It&#8217;s the time for lists&#8221;, I read somewhere today. Sure, that is true. But blogging little lists isn&#8217;t much fun.</p>
<p>So, I will let you generate your very own TOP 10 list. Use the following <a href="http://www.microsoft.com/windowsserver2003/technologies/management/powershell/default.mspx" target='_blank'>Powershell</a> Oneliner to get a TOP 10 list of your most frequently used cmdlets in your scripts. (Remember to modify the path to your script storage location.)</p>
<p>Happy Holidays!</p>
<blockquote><p>Get-ChildItem D:Scripts -Filter *.ps1 -Recurse |<br />
 Select-String (Get-Command|%{$_.Name}) |<br />
 Group Pattern |<br />
 Sort Count -Descending |<br />
 Select -First 10 |<br />
 Format-Table Name, Count -AutoSize</p></blockquote>
<p>No related posts.</p>]]></content:encoded>
			<wfw:commentRss>http://www.peetersonline.nl/index.php/powershell/top-10-commandlets-in-a-oneliner/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Oneliner: Get Logged on Users with Powershell</title>
		<link>http://www.peetersonline.nl/index.php/powershell/oneliner-get-logged-on-users-with-powershell/</link>
		<comments>http://www.peetersonline.nl/index.php/powershell/oneliner-get-logged-on-users-with-powershell/#comments</comments>
		<pubDate>Tue, 18 Nov 2008 14:32:10 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Oneliners]]></category>
		<category><![CDATA[PowerShell]]></category>
		<category><![CDATA[Oneliner]]></category>
		<category><![CDATA[Users]]></category>
		<category><![CDATA[WMI]]></category>

		<guid isPermaLink="false">http://www.peetersonline.nl/index.php/powershell/oneliner-get-logged-on-users-with-powershell/</guid>
		<description><![CDATA[Check out this oneliner/function! Provide a computer name and it will return the logged on users. function Get-MyLoggedOnUsers {  param([string]$Computer)  Get-WmiObject Win32_LoggedOnUser -ComputerName $Computer &#124; Select Antecedent -Unique &#124; %{&#8220;{0}{1}&#8221; -f $_.Antecedent.ToString().Split(&#8216;&#8221;&#8216;)[1], $_.Antecedent.ToString().Split(&#8216;&#8221;&#8216;)[3]} } Hugo No related posts.
No related posts.]]></description>
			<content:encoded><![CDATA[<p>Check out this oneliner/function! Provide a computer name and it will return the logged on users.</p>
<blockquote><p>function Get-MyLoggedOnUsers<br />
{<br />
 param([string]$Computer)<br />
 Get-WmiObject Win32_LoggedOnUser -ComputerName $Computer | Select Antecedent -Unique | %{&#8220;{0}{1}&#8221; -f $_.Antecedent.ToString().Split(&#8216;&#8221;&#8216;)[1], $_.Antecedent.ToString().Split(&#8216;&#8221;&#8216;)[3]}<br />
}</p></blockquote>
<p>Hugo</p>
<p>No related posts.</p>]]></content:encoded>
			<wfw:commentRss>http://www.peetersonline.nl/index.php/powershell/oneliner-get-logged-on-users-with-powershell/feed/</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
		<item>
		<title>VMware Stats Oneliner</title>
		<link>http://www.peetersonline.nl/index.php/vmware/vmware-stats-oneliner/</link>
		<comments>http://www.peetersonline.nl/index.php/vmware/vmware-stats-oneliner/#comments</comments>
		<pubDate>Fri, 17 Oct 2008 13:53:42 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Oneliners]]></category>
		<category><![CDATA[PowerShell]]></category>
		<category><![CDATA[VMware]]></category>
		<category><![CDATA[Oneliner]]></category>
		<category><![CDATA[PowerCLI]]></category>
		<category><![CDATA[Stat]]></category>
		<category><![CDATA[VI Toolkit]]></category>

		<guid isPermaLink="false">http://www.peetersonline.nl/index.php/vmware/vmware-stats-oneliner/</guid>
		<description><![CDATA[Today&#8217;s oneliner is a nifty little function that reports the average CPU and Memory usage for one or more of your VMs, calculated over the last x hours: function Get-VMStat { param( $VM,[Int32]$Hours = 1 )  $VM &#124; Sort Name &#124;  Select Name, @{N=&#8221;CPU&#8221;;E={[Math]::Round((($_ &#124;  Get-Stat -Stat cpu.usage.average -Start (Get-Date).AddHours(-$Hours) -IntervalMins 5 -MaxSamples ($Hours*12) &#124; <a href='http://www.peetersonline.nl/index.php/vmware/vmware-stats-oneliner/'>[...]</a>
Related posts:<ol>
<li><a href='http://www.peetersonline.nl/index.php/vmware/remove-vmware-memory-limits-with-powershell/' rel='bookmark' title='Remove vmware memory limits with Powershell'>Remove vmware memory limits with Powershell</a></li>
<li><a href='http://www.peetersonline.nl/index.php/vmware/calculate-vsphere-5-licenses-with-powershell/' rel='bookmark' title='Calculate vSphere 5 Licenses with Powershell (UPDATED)'>Calculate vSphere 5 Licenses with Powershell (UPDATED)</a></li>
</ol>]]></description>
			<content:encoded><![CDATA[<p>Today&#8217;s oneliner is a nifty little function that reports the average CPU and Memory usage for one or more of your VMs, calculated over the last x hours:</p>
<blockquote><p>function Get-VMStat<br />
{<br />
param( $VM,[Int32]$Hours = 1 )<br />
 $VM | Sort Name |<br />
 Select Name, @{N=&#8221;CPU&#8221;;E={[Math]::Round((($_ |<br />
 Get-Stat -Stat cpu.usage.average -Start (Get-Date).AddHours(-$Hours) -IntervalMins 5 -MaxSamples ($Hours*12) |<br />
 Measure-Object Value -Average).Average),2)}}, @{N=&#8221;MEM&#8221;;E={[Math]::Round((($_ |<br />
 Get-Stat -Stat mem.usage.average -Start (Get-Date).AddHours(-$Hours) -IntervalMins 5 -MaxSamples ($Hours*12) |<br />
 Measure-Object Value -Average).Average),2)}}<br />
}</p></blockquote>
<p>A great way to use it is like this:</p>
<blockquote><p>Get-VMStat (Get-VM) -Hours 4 | Where {$_.CPU -gt 50 -or $_.MEM -gt 75}</p></blockquote>
<p>I&#8217;m sure you can figure out what that does. Be the first to give the correct answer in the comments to win everlasting glory! (or at least until the next oneliner&#8230;)</p>
<p>Enjoy!</p>
<p>Related posts:<ol>
<li><a href='http://www.peetersonline.nl/index.php/vmware/remove-vmware-memory-limits-with-powershell/' rel='bookmark' title='Remove vmware memory limits with Powershell'>Remove vmware memory limits with Powershell</a></li>
<li><a href='http://www.peetersonline.nl/index.php/vmware/calculate-vsphere-5-licenses-with-powershell/' rel='bookmark' title='Calculate vSphere 5 Licenses with Powershell (UPDATED)'>Calculate vSphere 5 Licenses with Powershell (UPDATED)</a></li>
</ol></p>]]></content:encoded>
			<wfw:commentRss>http://www.peetersonline.nl/index.php/vmware/vmware-stats-oneliner/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>Oneliner of the day</title>
		<link>http://www.peetersonline.nl/index.php/vmware/oneliner-of-the-day/</link>
		<comments>http://www.peetersonline.nl/index.php/vmware/oneliner-of-the-day/#comments</comments>
		<pubDate>Thu, 16 Oct 2008 14:33:58 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Oneliners]]></category>
		<category><![CDATA[PowerShell]]></category>
		<category><![CDATA[VMware]]></category>
		<category><![CDATA[description]]></category>
		<category><![CDATA[Oneliner]]></category>
		<category><![CDATA[PowerCLI]]></category>
		<category><![CDATA[VI Toolkit]]></category>

		<guid isPermaLink="false">http://www.peetersonline.nl/index.php/vmware/oneliner-of-the-day/</guid>
		<description><![CDATA[Do your fellow VMware Admins sometimes forget to fill in the Notes field for a new vm they create? Or would you like to change those inconsistent notes to something more accurate? Todays oneliner simply copies the Active Directory description field into your Virtual Infrastructure. It&#8217;s quite blunt about it. Besides asking if you really <a href='http://www.peetersonline.nl/index.php/vmware/oneliner-of-the-day/'>[...]</a>
Related posts:<ol>
<li><a href='http://www.peetersonline.nl/index.php/vmware/calculate-vsphere-5-licenses-with-powershell/' rel='bookmark' title='Calculate vSphere 5 Licenses with Powershell (UPDATED)'>Calculate vSphere 5 Licenses with Powershell (UPDATED)</a></li>
<li><a href='http://www.peetersonline.nl/index.php/vmware/remove-vmware-memory-limits-with-powershell/' rel='bookmark' title='Remove vmware memory limits with Powershell'>Remove vmware memory limits with Powershell</a></li>
</ol>]]></description>
			<content:encoded><![CDATA[<p>Do your fellow <a href="http://www.vmware.com/" target='_blank'>VMware</a> Admins sometimes forget to fill in the Notes field for a new vm they create? Or would you like to change those inconsistent notes to something more accurate? Todays oneliner simply copies the Active Directory description field into your Virtual Infrastructure. It&#8217;s quite blunt about it. Besides asking if you really want to do so, it shows a lot of errors for servers that are powered off or cannot be found in AD. But it pretty much does the trick.</p>
<blockquote><p>Get-VM | ForEach { Set-VM -VM $_ -Description (Get-QADComputer ($_ | Get-View).Guest.HostName.Split(&#8220;.&#8221;)[0]).Description } </p></blockquote>
<p>If your vm&#8217;s always have the same name as defined in the VM Guest OS, you can suffice with:</p>
<blockquote><p>Get-VM | ForEach { Set-VM -VM $_ -Description (Get-QADComputer $_.Name).Description } </p></blockquote>
<p>If you want more advanced description synching, check out <a href="http://www.peetersonline.nl/index.php/vmware/are-your-names-in-sync-helpful-script-of-the-day/">the full script</a>.</p>
<p>Enjoy!</p>
<p>Related posts:<ol>
<li><a href='http://www.peetersonline.nl/index.php/vmware/calculate-vsphere-5-licenses-with-powershell/' rel='bookmark' title='Calculate vSphere 5 Licenses with Powershell (UPDATED)'>Calculate vSphere 5 Licenses with Powershell (UPDATED)</a></li>
<li><a href='http://www.peetersonline.nl/index.php/vmware/remove-vmware-memory-limits-with-powershell/' rel='bookmark' title='Remove vmware memory limits with Powershell'>Remove vmware memory limits with Powershell</a></li>
</ol></p>]]></content:encoded>
			<wfw:commentRss>http://www.peetersonline.nl/index.php/vmware/oneliner-of-the-day/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Oneliner for the road</title>
		<link>http://www.peetersonline.nl/index.php/vmware/oneliner-for-the-road/</link>
		<comments>http://www.peetersonline.nl/index.php/vmware/oneliner-for-the-road/#comments</comments>
		<pubDate>Wed, 10 Sep 2008 13:12:47 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Oneliners]]></category>
		<category><![CDATA[PowerShell]]></category>
		<category><![CDATA[VMware]]></category>
		<category><![CDATA[Oneliner]]></category>
		<category><![CDATA[PowerCLI]]></category>
		<category><![CDATA[VI Toolkit]]></category>

		<guid isPermaLink="false">http://www.peetersonline.nl/index.php/vmware/one-liner-for-the-road/</guid>
		<description><![CDATA[Okay, so I&#8217;ve just announced I won&#8217;t  post anything for the coming month. You must all feel very sad. Well, before leaving you sobbing over an empty feed reader, here&#8217;s one more oneliner. One for the road. Get-VMHost &#124; Sort Name &#124; Get-View &#124; Select Name, @{N=&#8221;MemoryGB&#8221;;E={[math]::Round((($_.Summary.Hardware.MemorySize)/1GB),0)}}, @{N=&#8221;MemoryUsageGB&#8221;;E={[math]::Round((($_.summary.quickstats.overallmemoryusage)*1MB/1GB),2)}}, @{N=&#8221;Percentage&#8221;;E={[Math]::Round(100*(($_.Summary.QuickStats.OverallMemoryUsage*1MB/1GB)/($_.Summary.Hardware.MemorySize/1GB)),0)}} What the *bleep* does that do? I&#8217;ll <a href='http://www.peetersonline.nl/index.php/vmware/oneliner-for-the-road/'>[...]</a>
Related posts:<ol>
<li><a href='http://www.peetersonline.nl/index.php/vmware/calculate-vsphere-5-licenses-with-powershell/' rel='bookmark' title='Calculate vSphere 5 Licenses with Powershell (UPDATED)'>Calculate vSphere 5 Licenses with Powershell (UPDATED)</a></li>
<li><a href='http://www.peetersonline.nl/index.php/vmware/remove-vmware-memory-limits-with-powershell/' rel='bookmark' title='Remove vmware memory limits with Powershell'>Remove vmware memory limits with Powershell</a></li>
</ol>]]></description>
			<content:encoded><![CDATA[<p>Okay, so I&#8217;ve just announced I won&#8217;t  post anything for the coming month. You must all feel very sad.</p>
<p>Well, before leaving you sobbing over an empty feed reader, here&#8217;s one more oneliner. One for the road.</p>
<blockquote><p>Get-VMHost | Sort Name | Get-View | Select Name, @{N=&#8221;MemoryGB&#8221;;E={[math]::Round((($_.Summary.Hardware.MemorySize)/1GB),0)}}, @{N=&#8221;MemoryUsageGB&#8221;;E={[math]::Round((($_.summary.quickstats.overallmemoryusage)*1MB/1GB),2)}}, @{N=&#8221;Percentage&#8221;;E={[Math]::Round(100*(($_.Summary.QuickStats.OverallMemoryUsage*1MB/1GB)/($_.Summary.Hardware.MemorySize/1GB)),0)}}</p></blockquote>
<p>What the *bleep* does <em>that</em> do? I&#8217;ll explain it to you:</p>
<ul>
<li>It grabs your <a href="http://www.vmware.com/" target='_blank'>VMware</a> Servers (Get-VMHost)</li>
<li>Sorts them by Name (Sort Name)</li>
<li>Gets the advanced properties (Get-View)</li>
<li>Selects some properties to show you (Select), being:
<ul>
<li>The server Name (Name)</li>
<li>Something called MemoryMB, which is the value of the Summary.Hardware.MemorySize property devided by 1 GB and rounded to zero digits.</li>
<li>Something called MemoryUsageGB, which is the value of the Summary.QuickStats.OverallMemoryUsage property (which is already in MBs), converted to GBs and rounded to two digits.</li>
<li>Something called Percentage, which is 100 times the MemoryUsage in GBs divided by the Memory in GBs, rounded to zero digits.</li>
</ul>
</li>
</ul>
<p>Can&#8217;t you do something like that with Get-Stat?<br />
Sure, but wouldn&#8217;t be near as much fun.</p>
<p>Adios!<br />
Hugo</p>
<p>Related posts:<ol>
<li><a href='http://www.peetersonline.nl/index.php/vmware/calculate-vsphere-5-licenses-with-powershell/' rel='bookmark' title='Calculate vSphere 5 Licenses with Powershell (UPDATED)'>Calculate vSphere 5 Licenses with Powershell (UPDATED)</a></li>
<li><a href='http://www.peetersonline.nl/index.php/vmware/remove-vmware-memory-limits-with-powershell/' rel='bookmark' title='Remove vmware memory limits with Powershell'>Remove vmware memory limits with Powershell</a></li>
</ol></p>]]></content:encoded>
			<wfw:commentRss>http://www.peetersonline.nl/index.php/vmware/oneliner-for-the-road/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Posting Pause (plus bonus oneliner)</title>
		<link>http://www.peetersonline.nl/index.php/vmware/posting-pause-plus-bonus-one-liner/</link>
		<comments>http://www.peetersonline.nl/index.php/vmware/posting-pause-plus-bonus-one-liner/#comments</comments>
		<pubDate>Wed, 10 Sep 2008 08:22:33 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Oneliners]]></category>
		<category><![CDATA[PowerShell]]></category>
		<category><![CDATA[VMware]]></category>
		<category><![CDATA[Oneliner]]></category>
		<category><![CDATA[PowerCLI]]></category>
		<category><![CDATA[VI Toolkit]]></category>

		<guid isPermaLink="false">http://www.peetersonline.nl/index.php/vmware/posting-pause-plus-bonus-one-liner/</guid>
		<description><![CDATA[I&#8217;m sorry to announce that I won&#8217;t be able to post anything until the beginning of October. But I will be back, so please keep me in your RSS feed or check back here in a month. I&#8217;ll be back full-force, with more awesome one-liners, helpful scripts and fantastic functions! Here&#8217;s a one-liner to show <a href='http://www.peetersonline.nl/index.php/vmware/posting-pause-plus-bonus-one-liner/'>[...]</a>
Related posts:<ol>
<li><a href='http://www.peetersonline.nl/index.php/vmware/calculate-vsphere-5-licenses-with-powershell/' rel='bookmark' title='Calculate vSphere 5 Licenses with Powershell (UPDATED)'>Calculate vSphere 5 Licenses with Powershell (UPDATED)</a></li>
<li><a href='http://www.peetersonline.nl/index.php/vmware/remove-vmware-memory-limits-with-powershell/' rel='bookmark' title='Remove vmware memory limits with Powershell'>Remove vmware memory limits with Powershell</a></li>
</ol>]]></description>
			<content:encoded><![CDATA[<p>I&#8217;m sorry to announce that I won&#8217;t be able to post anything until the beginning of October. But I <em>will</em> be back, so please keep me in your RSS feed or check back here in a month. I&#8217;ll be back full-force, with more awesome one-liners, helpful scripts and fantastic functions!</p>
<p>Here&#8217;s a one-liner to show off to your colleagues. What do you do when somebody asks you for a printed overview of the top-twenty volumes on your virtual servers with the least free disk space?</p>
<p>You fire up your trusty <a href="http://www.microsoft.com/windowsserver2003/technologies/management/powershell/default.mspx" target='_blank'>Powershell</a> of course! You type a single line of code, press enter and tell them to check the printer. How cool is that?</p>
<blockquote><p>Get-VM | Where { $_.PowerState -eq &#8220;PoweredOn&#8221; } | Get-VMGuest | Select VmName -ExpandProperty Disks | Select VmName, Path, @{N=&#8221;MBFree&#8221;;E={[math]::Round((($_.FreeSpace)/1MB),2)}} | Sort MBFree | Select -First 20 | Format-Table -AutoSize | Out-Printer</p></blockquote>
<p>Very cool indeed!</p>
<p>See you next month!</p>
<p>Hugo</p>
<p>Related posts:<ol>
<li><a href='http://www.peetersonline.nl/index.php/vmware/calculate-vsphere-5-licenses-with-powershell/' rel='bookmark' title='Calculate vSphere 5 Licenses with Powershell (UPDATED)'>Calculate vSphere 5 Licenses with Powershell (UPDATED)</a></li>
<li><a href='http://www.peetersonline.nl/index.php/vmware/remove-vmware-memory-limits-with-powershell/' rel='bookmark' title='Remove vmware memory limits with Powershell'>Remove vmware memory limits with Powershell</a></li>
</ol></p>]]></content:encoded>
			<wfw:commentRss>http://www.peetersonline.nl/index.php/vmware/posting-pause-plus-bonus-one-liner/feed/</wfw:commentRss>
		<slash:comments>6</slash:comments>
		</item>
		<item>
		<title>Quick VI Toolkit Oneliners</title>
		<link>http://www.peetersonline.nl/index.php/vmware/quick-vi-toolkit-one-liners/</link>
		<comments>http://www.peetersonline.nl/index.php/vmware/quick-vi-toolkit-one-liners/#comments</comments>
		<pubDate>Tue, 09 Sep 2008 12:35:08 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Oneliners]]></category>
		<category><![CDATA[PowerShell]]></category>
		<category><![CDATA[VMware]]></category>
		<category><![CDATA[Oneliner]]></category>
		<category><![CDATA[PowerCLI]]></category>
		<category><![CDATA[VI Toolkit]]></category>

		<guid isPermaLink="false">http://www.peetersonline.nl/index.php/vmware/quick-vi-toolkit-one-liners/</guid>
		<description><![CDATA[Today, I have some quick-and-easy VI Toolkit &#8216;Get-VIEvent&#8217; one-liners for you. Let&#8217;s get started right away: To get all events relating to a certain Virtual Machine, try this: Get-VM &#8220;MyVMName&#8221; &#124; Get-VIEvent &#124; Format-Table CreatedTime, FullFormattedMessage -AutoSize To get all errors from the past 24 hours, enter: Get-VIEvent -Start (Get-Date).AddHours(-24) -Type Error &#124; Format-Table CreatedTime, <a href='http://www.peetersonline.nl/index.php/vmware/quick-vi-toolkit-one-liners/'>[...]</a>
Related posts:<ol>
<li><a href='http://www.peetersonline.nl/index.php/vmware/calculate-vsphere-5-licenses-with-powershell/' rel='bookmark' title='Calculate vSphere 5 Licenses with Powershell (UPDATED)'>Calculate vSphere 5 Licenses with Powershell (UPDATED)</a></li>
<li><a href='http://www.peetersonline.nl/index.php/vmware/remove-vmware-memory-limits-with-powershell/' rel='bookmark' title='Remove vmware memory limits with Powershell'>Remove vmware memory limits with Powershell</a></li>
</ol>]]></description>
			<content:encoded><![CDATA[<p>Today, I have some quick-and-easy <a href="http://www.vmware.com/sdk/vitk_win/index.html" target='_blank'>VI Toolkit</a> &#8216;Get-VIEvent&#8217; one-liners for you. Let&#8217;s get started right away:</p>
<p>To get all events relating to a certain Virtual Machine, try this:</p>
<blockquote><p>Get-VM &#8220;MyVMName&#8221; | Get-VIEvent | Format-Table CreatedTime, FullFormattedMessage -AutoSize</p></blockquote>
<p>To get all errors from the past 24 hours, enter:</p>
<blockquote><p>Get-VIEvent -Start (Get-Date).AddHours(-24) -Type Error | Format-Table CreatedTime, FullFormattedMessage -AutoSize</p></blockquote>
<p>To get all errors related to a cluster, type:</p>
<blockquote><p>Get-Cluster &#8220;MyClusterName&#8221; | Get-VIEvent -Type Error | Format-Table CreatedTime, FullFormattedMessage -AutoSize</p></blockquote>
<p>Finally, to get all events related to DRS:</p>
<blockquote><p>Get-VIEvent | Where {$_.FulFormattedMessage -match &#8220;DRS&#8221;} | Format-Table CreatedTime, FullFormattedMessage -AutoSize</p></blockquote>
<p>As you can see, the possabilities are endless!<br />
Enjoy!</p>
<p>Related posts:<ol>
<li><a href='http://www.peetersonline.nl/index.php/vmware/calculate-vsphere-5-licenses-with-powershell/' rel='bookmark' title='Calculate vSphere 5 Licenses with Powershell (UPDATED)'>Calculate vSphere 5 Licenses with Powershell (UPDATED)</a></li>
<li><a href='http://www.peetersonline.nl/index.php/vmware/remove-vmware-memory-limits-with-powershell/' rel='bookmark' title='Remove vmware memory limits with Powershell'>Remove vmware memory limits with Powershell</a></li>
</ol></p>]]></content:encoded>
			<wfw:commentRss>http://www.peetersonline.nl/index.php/vmware/quick-vi-toolkit-one-liners/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Powershell Oneliner #6</title>
		<link>http://www.peetersonline.nl/index.php/vmware/powershell-oneliner-6/</link>
		<comments>http://www.peetersonline.nl/index.php/vmware/powershell-oneliner-6/#comments</comments>
		<pubDate>Tue, 19 Aug 2008 08:24:20 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Oneliners]]></category>
		<category><![CDATA[PowerShell]]></category>
		<category><![CDATA[VMware]]></category>
		<category><![CDATA[datastores]]></category>
		<category><![CDATA[PowerCLI]]></category>
		<category><![CDATA[VI Toolkit]]></category>

		<guid isPermaLink="false">http://www.peetersonline.nl/index.php/vmware/powershell-oneliner-6/</guid>
		<description><![CDATA[Today&#8217;s oneliner is an incredibly fast way to check the usage of your VMware datastores. You should first connect to Virtual Center in the following way: $VC = Connect-VIServer &#8220;YourVCServerName&#8221; Here comes the oneliner: Get-Datastore &#124; Sort-Object Name &#124; %{Get-View $_.Id} &#124; Format-Table @{Label=&#8221;Name&#8221;;Expression={$_.info.name}}, @{Label=&#8221;NumVMs&#8221;;Expression={$_.vm.length}} Only interested in datastores that are not used? Use the <a href='http://www.peetersonline.nl/index.php/vmware/powershell-oneliner-6/'>[...]</a>
Related posts:<ol>
<li><a href='http://www.peetersonline.nl/index.php/vmware/remove-vmware-memory-limits-with-powershell/' rel='bookmark' title='Remove vmware memory limits with Powershell'>Remove vmware memory limits with Powershell</a></li>
<li><a href='http://www.peetersonline.nl/index.php/vmware/calculate-vsphere-5-licenses-with-powershell/' rel='bookmark' title='Calculate vSphere 5 Licenses with Powershell (UPDATED)'>Calculate vSphere 5 Licenses with Powershell (UPDATED)</a></li>
</ol>]]></description>
			<content:encoded><![CDATA[<p>Today&#8217;s oneliner is an incredibly fast way to check the usage of your <a href="http://www.vmware.com/" target='_blank'>VMware</a> datastores. You should first connect to Virtual Center in the following way:</p>
<blockquote><p>$VC = Connect-VIServer &#8220;YourVCServerName&#8221;</p></blockquote>
<p>Here comes the oneliner:</p>
<blockquote><p>Get-Datastore | Sort-Object Name | %{Get-View $_.Id} | Format-Table @{Label=&#8221;Name&#8221;;Expression={$_.info.name}}, @{Label=&#8221;NumVMs&#8221;;Expression={$_.vm.length}}</p></blockquote>
<p>Only interested in datastores that are not used? Use the <em>Where-Object</em> cmdlet:</p>
<blockquote><p>Get-Datastore | Sort-Object Name | %{Get-View $_.Id} | Where {$_.vm.length -eq 0} | Format-Table @{Label=&#8221;Name&#8221;;Expression={$_.info.name}}, @{Label=&#8221;NumVMs&#8221;;Expression={$_.vm.length}}</p></blockquote>
<p>But watch out! Consider a vm with a disk in datastore A and the vmx in datastore B. When you create a snapshot of the vm, the delta files of all disks will be stored with the vmx (in datastore B). The script (as does the VI Client) will show the vm to be <strong>not connected</strong> to datastore A!</p>
<p>Enjoy!</p>
<p>Related posts:<ol>
<li><a href='http://www.peetersonline.nl/index.php/vmware/remove-vmware-memory-limits-with-powershell/' rel='bookmark' title='Remove vmware memory limits with Powershell'>Remove vmware memory limits with Powershell</a></li>
<li><a href='http://www.peetersonline.nl/index.php/vmware/calculate-vsphere-5-licenses-with-powershell/' rel='bookmark' title='Calculate vSphere 5 Licenses with Powershell (UPDATED)'>Calculate vSphere 5 Licenses with Powershell (UPDATED)</a></li>
</ol></p>]]></content:encoded>
			<wfw:commentRss>http://www.peetersonline.nl/index.php/vmware/powershell-oneliner-6/feed/</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
	</channel>
</rss>

