SHIFT

--- Sjoerd Hooft's InFormation Technology ---

User Tools

Site Tools


Sidebar

Sponsor:

Would you like to sponsor this site?
Or buy me a beer?:


Recently Changed Pages:

View All Pages
View All Q Pages


View All Tags


Sign up for Q to post comments.





WIKI Disclaimer: As with most other things on the Internet, the content on this wiki is not supported. It was contributed by me and is published “as is”. It has worked for me, and might work for you.
Also note that any view or statement expressed anywhere on this site are strictly mine and not the opinions or views of my employer.


Terms And Conditions for Q users


Pages with comments

PageDateDiscussionTags
2019/06/22 10:36 1 Comment
2019/03/15 16:02 1 Comment
2019/03/15 16:02 1 Comment
2019/03/15 16:02 3 Comments
2017/04/20 15:28 1 Comment
2017/04/20 15:23 1 Comment
2017/04/19 14:44 1 Comment
2017/04/17 20:10 1 Comment
2017/04/17 20:07 1 Comment
2017/04/17 19:58 1 Comment
2017/04/17 19:52 1 Comment

View All Comments

powercligethostnetworkinfo

Script: PowerCLI: Get Host Network Information

This script will grab all network information from a host including:

  • vmnic configuration
  • vmkernel ports information
  • service console information
  • all virtual switches
  • all port groups
# Basehost must be an exact match to the name in vcenter
$BASEHost = Read-Host "Enter the name of the server as found in vCenter"
 
$timestamp = Get-Date -format "yyyyMMdd-HH.mm"
$outfile = "D:\sjoerd\$timestamp-$basehost-networkinfo.txt"
 
$timestamp | Out-File $outfile
 
# Original command:
# Get-VMHostNetwork $BASEHost | Select HostName,Domain,ConsoleGateWay,DnsAddress
Add-Content $outfile "`nFinding VMkernel and Service Console information on $BASEHost" -Encoding unicode
Get-VMHostNetwork $BASEHost | Format-List | Out-File $outfile -width 500 -append
 
# Original command:
# Get-VMHostNetworkAdapter $BASEHost | select VMhost, Name, IP, SubnetMask, Mac, PortGroupName, vMotionEnabled, mtu, FullDuplex, BitRatePerSec
# Get-VMHostNetworkAdapter $BASEHost | select VMhost, Name, IP, SubnetMask, Mac, PortGroupName, vMotionEnabled, mtu, FullDuplex, BitRatePerSec | Export-Csv $csvfilenic
Add-Content $outfile "`nListing all NIC information on $BASEHost" -Encoding unicode
Get-VMHostNetworkAdapter $BASEHost | select VMhost, Name, IP, SubnetMask, Mac, PortGroupName, vMotionEnabled, mtu, FullDuplex, DHCPEnabled, BitRatePerSec | Out-File $outfile -width 500 -append
 
Get-VirtualSwitch $BASEHost |Foreach {
   $switch = $_.Name
   $numports = $_.NumPorts
   $mtu = $_.Mtu
   Add-Content $outfile "`nSwitch $switch on $BASEHost has $numports number of ports and has a configured mtu size of $mtu" -Encoding unicode
   $_ |Get-VirtualPortGroup |Foreach {
   $portgroup = $_.Name
   $vlan = $_.VlanID
   Add-Content $outfile "`nPortgroup $portgroup has vlanid $vlan" -Encoding unicode
   }
}
You could leave a comment if you were logged in.
powercligethostnetworkinfo.txt · Last modified: 2013/04/20 13:33 by sjoerd