VMware Cloud Community
ssauer
Contributor
Contributor

TOP 10 VI Toolkit Oneliners!

Maybe this already exisits somewhere, has someone done a top 10 list of "best VIToolkit commands"? People could submit, rate etc and push out a list? Thought it would be useful.

0 Kudos
10 Replies
halr9000
Commander
Commander

I think this list is waiting for you to write it. 🙂




[PowerShell MVP|https://mvp.support.microsoft.com/profile=5547F213-A069-45F8-B5D1-17E5BD3F362F], VI Toolkit forum moderator

Author of the upcoming book: Managing VMware Infrastructure with PowerShell

Co-Host, PowerScripting Podcast (http://powerscripting.net)

My signature used to be pretty, but then the forum software broked it. vExpert. Microsoft MVP (Windows PowerShell). Author, Podcaster, Speaker. I'm @halr9000
0 Kudos
ssauer
Contributor
Contributor

No problem, this is a request to everyone, please post your top 10 VI Toolkit comands (ones you find the most useful everday admin commands you couldn't live without). Depending on the feedback from this post, I will compile the list.

0 Kudos
heyitspablo
VMware Employee
VMware Employee

If folks can provide a list of 20 or so I can create a community poll, might easier to track in real time. Let me know.

Regards,

Pablo

Keep up with latest info on vSphere PowerCLI http://blogs.vmware.com/vipowershell - Follow me on Twitter @heyitspablo
0 Kudos
ssauer
Contributor
Contributor

Sounds easier to me Pablo let's do it.

0 Kudos
Smitty_Smith
Enthusiast
Enthusiast

Here are my inputs in order of use for me:

Get-Credentials

Connect-VIServer

Disconnect-VIServer

Get-VM

Get-VMHost

Get-Content

Get-Cluster

Get-Snapshot

Get-HardDisk

Add-VMHost

Get-VirtualSwitch

Get-VirtualPortGroup

Set-VirtualSwitch

New-VirtualPortGroup

New-VirtualSwitch

Get-VMHostNetwork

Get-VMHostFirewallException

Set-VMHostFirewallException

Get-NetworkAdapter

Start-VMHostService

0 Kudos
ssauer
Contributor
Contributor

Thanks Smitty for your input. I was thinking along the lines of functional commands, for example here is one I use all the time to rescan all my HBA's across my ESX farm when I add new luns:

Get-VMHost | Get-VMHostStorage -RescanAllHba

0 Kudos
Smitty_Smith
Enthusiast
Enthusiast

Sorry, misunderstood. Guess that leaves me out. I don't tend to do single command groups but instead write multifunction scripts (with much help from this forum of course).

0 Kudos
hugopeeters
Hot Shot
Hot Shot

So you really mean "TOP 10 VI Toolkit Oneliners"?

My 2 cents:

To get all errors from the past 24 hours, enter:

Get-VIEvent -Start (Get-Date).AddHours(-24) -Type Error | Format-Table CreatedTime, FullFormattedMessage -AutoSize

A printed overview of the top-twenty volumes on your virtual servers with the least free disk space:

Get-VM | Where { $_.PowerState -eq “PoweredOn” } | Get-VMGuest | Select VmName -ExpandProperty Disks | Select VmName, Path, @{N=”MBFree”;E={[math]::Round((($_.FreeSpace)/1MB),2)}} | Sort MBFree | Select -First 20 | Format-Table -AutoSize | Out-Printer

Setting VM descriptions:

Get-VM | ForEach { Set-VM -VM $_ -Description (Get-QADComputer $_.Name).Description }

Finally:

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)}}

(Search my website if you cannot figure out what it does Smiley Wink )

Hugo Peeters

www.peetersonline.nl

0 Kudos
halr9000
Commander
Commander

http://halr9000.com/article/tag/vi-toolkit-one-liner




[PowerShell MVP|https://mvp.support.microsoft.com/profile=5547F213-A069-45F8-B5D1-17E5BD3F362F], VI Toolkit forum moderator

Author of the upcoming book: Managing VMware Infrastructure with PowerShell

Co-Host, PowerScripting Podcast (http://powerscripting.net)

My signature used to be pretty, but then the forum software broked it. vExpert. Microsoft MVP (Windows PowerShell). Author, Podcaster, Speaker. I'm @halr9000
0 Kudos
ssauer
Contributor
Contributor

Yep thats more appropriate I imagine, I updated the subject to reflect.

0 Kudos