Getting the Service Console IP addresses of your ESX servers with vSphere PowerCLI (formerly known as the VI Toolkit for Powershell):
Get-VMHost | Select Name, @{N="ConsoleIP";E={(Get-VMHostNetwork).ConsoleNic | ForEach{$_.IP}}}
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 | Sort Name | Select Name, @{N=”NTP”;E={Get-VMHostNtpServer $_}}
“It’s the time for lists”, I read somewhere today. Sure, that is true. But blogging little lists isn’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 [...]
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 | Select Antecedent -Unique | %{“{0}{1}” -f $_.Antecedent.ToString().Split(‘”‘)[1], $_.Antecedent.ToString().Split(‘”‘)[3]}
}
Hugo
Today’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 | Sort Name |
Select Name, @{N=”CPU”;E={[Math]::Round((($_ |
Get-Stat -Stat cpu.usage.average -Start (Get-Date).AddHours(-$Hours) [...]
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’s quite blunt about it. Besides asking if [...]
Okay, so I’ve just announced I won’t post anything for the coming month. You must all feel very sad.
Well, before leaving you sobbing over an empty feed reader, here’s one more oneliner. One for the road.
Get-VMHost | Sort Name | Get-View | Select Name, @{N=”MemoryGB”;E={[math]::Round((($_.Summary.Hardware.MemorySize)/1GB),0)}}, @{N=”MemoryUsageGB”;E={[math]::Round((($_.summary.quickstats.overallmemoryusage)*1MB/1GB),2)}}, @{N=”Percentage”;E={[Math]::Round(100*(($_.Summary.QuickStats.OverallMemoryUsage*1MB/1GB)/($_.Summary.Hardware.MemorySize/1GB)),0)}}
What the *bleep* does that do? I’ll [...]
I’m sorry to announce that I won’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’ll be back full-force, with more awesome one-liners, helpful scripts and fantastic functions!
Here’s a one-liner to show [...]
Today, I have some quick-and-easy VI Toolkit ‘Get-VIEvent’ one-liners for you. Let’s get started right away:
To get all events relating to a certain Virtual Machine, try this:
Get-VM “MyVMName” | Get-VIEvent | Format-Table CreatedTime, FullFormattedMessage -AutoSize
To get all errors from the past 24 hours, enter:
Get-VIEvent -Start (Get-Date).AddHours(-24) -Type Error | [...]
Today’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 “YourVCServerName”
Here comes the oneliner:
Get-Datastore | Sort-Object Name | %{Get-View $_.Id} | Format-Table @{Label=”Name”;Expression={$_.info.name}}, @{Label=”NumVMs”;Expression={$_.vm.length}}
Only interested in datastores that are not used? [...]
Tags
Active Directory API bind order cleanup cluster CPU Custom Fields datastores description device management directory tree errors Event Log file name filter Fun function HA IT known issues License Server LUN multipath NIC objects Oneliner portgroups PowerCLI PowerShell profile recursive Registry Scripts security session share snapshots SQL Stat VI Toolkit VMware vSphere WMI WSUS ZenArchives
- July 2012
- July 2011
- February 2011
- January 2011
- December 2010
- May 2010
- October 2009
- September 2009
- August 2009
- July 2009
- June 2009
- May 2009
- April 2009
- March 2009
- February 2009
- January 2009
- December 2008
- November 2008
- October 2008
- September 2008
- August 2008
- July 2008
- June 2008
- May 2008
- April 2008
- March 2008
