Script to display information by hostname ESX hardware

Hello

This is my first post, because I'm new to powershell and trying to get my head around all this.

I have a script where I want to put together different values for ESX hardware, but also to display the associated host name. I have the job of script but I want to display the MemorySize in GB rounded to 0 decimal places, for example 12.1234567890 GB displayed as 12 GB. I can't understand how this go up.

Script is the following:

$report = @ () $virtualhosts = get-VMhost foreach ($vhost in $virtualhosts) {$objects $vhost = | get-view | foreach-object {$_.summary.hardware} foreach ($values in $objects) {$row = "" |}} SELECT name, vendor, model, memorysize, CpuModel, CpuMhz, NumCpuPkgs, NumCpuCores, NumCpuThreads, NumNics, NumHBAs $row.name = $vhost.name $row.vendor = $values.vendor $row.model = $values.model $ROW. MemorySize = $values. MemorySize/1 GB $row. CpuModel = $values. CpuModel $row.cpuMhz = $values. CPUMhz $row. NumCpuPkgs = $values. NumCpuPkgs $row. NumCpuCores = $values. NumCpuCores $row. NumCpuThreads = $values. NumCpuThreads $row. NumNics = $values. NumNics $row. NumHBAs = $values. NumHBAs

{{$report += $row}} $report

Of a single line of command, I can get the output to round to the 0 decimal places but cannot work out how to associate the host name (see the command line below)

Get-VMHost | Get-View | ForEach-Object {$_.} Summary.Hardware} | Select-object vendor, model, @{N = "Memory (GB)"; "} E = {[math]: Round ((($_.))} {{((MemorySize) / 1 GB), 0)}}, CpuModel, CpuMhz, NumCpuPkgs, NumCpuCores, NumCpuThreads, NumNics, NumHBAs

but can't figure how to do it is the script of foreach. Would be grateful for any help.

Thank you.

You can use the cmdlet Get-View to get the HostSystem objects.

Then, it's just a matter to fill all the properties in the $row variable.

For PowerShell formatting has the handy format operator (-f).

See Setting Digital Formats serial Master PowerShell of Tobias.

This would be an example of a script that does what I think you want to do

$report = @()
Get-View -ViewType HostSystem | % {
     $row = "" | select name, vendor, model, memorysize , CpuModel, CpuMhz, NumCpuPkgs, NumCpuCores, NumCpuThreads, NumNics, NumHBAs
     $row.name = $_.name
     $row.vendor = $_.Summary.Hardware.vendor
     $row.model = $_.Summary.Hardware.model
     $ROW.MemorySize = "{0:F0}" -f ($_.Summary.Hardware.MemorySize/1GB)
     $row.CpuModel = $_.Summary.Hardware.CpuModel
     $row.cpuMhz = $_.Summary.Hardware.CPUMhz
     $row.NumCpuPkgs = $_.Summary.Hardware.NumCpuPkgs
     $row.NumCpuCores = $_.Summary.Hardware.NumCpuCores
     $row.NumCpuThreads = $_.Summary.Hardware.NumCpuThreads
     $row.NumNics = $_.Summary.Hardware.NumNics
     $row.NumHBAs = $_.Summary.Hardware.NumHBAs

     $report += $row
}
$report

Note that you can also do

Get-VmHost | Get-View

Instead of

Get-View -ViewType HostSystem

But the first format is faster if you have a large number of ESX servers.

Tags: VMware

Similar Questions

  • How script a dialog box to display information?

    Hello.

    I have a dialog box that contains 7 lines and 2 columns to display information as such script:

    How do I do that?

    Any help would be appreciated.

    ScriptUI has tables, plus you can get is to use a listbox control. Depending on the version of your application, the lines will be written or not but I don't think that you can control.

    var w = new Window("dialog", "test");
    var lb = w.add("listbox{properties: {multiselect: false, numberOfColumns: 2, columnWidths: [60,60], columnTitles: ['A', 'B'], showHeaders: false}}");
    for (var k=1; k<8; k++){
        lb.add("item", (5*k).toString()).subItems[0].text = (11*(k+1)).toString();
        };
    
    w.show();
    

    You can play with the properties of creation.

    For me, if showHeaders is set to true, the columnTitles are displayed and the columnWidths property are respected.

    But if it is false, the columnTitles are not (as one would expect), but the columnWidths property are not respected...

    Xavier

  • Problem to display information in a message box

    Hi - I create a deployment script that creates a PSobject to display a summary of configuration changes I'm about to do to a host, as well as a YES / NO box to choose whether to continue with the configuration. The question I have is to get the PSObject information to correctly display correctly in the message box.  I can display ok in the console, but not in the message box.  I attach a doc with the release of the console box and message, I would like to the messagebox, output look the same as the way in which its displayed in the console.

    Code to create the PSObject...

    $hostname = $_.esxihost

    $dvswitch = $_.dvswitchname

    $pg_vmotion_1 = $_ .vmotion_pg_1

    $pg_vmotion_2 = $_ .vmotion_pg_2

    $pg_nfs_a = $_ .nfs_pg_A

    $pg_nfs_b = $_ .nfs_pg_B

    $vmk_vmotion_IP1 = $_. IP1_vmk_vmotion

    $vmk_vmotion_IP2 = $_. IP2_vmk_vmotion

    $vmk_vmotion_SM = $_. SM_vmk_vmotion

    $vmk_ipstorage_IP_VLAN128 = $_. VLAN128_vmk_ipstorage_IP

    $vmk_ipstorage_IP_VLAN129 = $_. VLAN129_vmk_ipstorage_IP

    $vmk_ipstorage_SM = $_. SM_vmk_ipstorage_IP

    $object = new-Object - Typename PSObject

    $object | Add-Member-MemberType NoteProperty - name ESXHostname - value $Hostname

    $object | Add-Member-MemberType NoteProperty - name DV_SwitchName - value $dvswitch

    $object | Add-Member-MemberType NoteProperty - name PG_1_VMotion - value $pg_vmotion_1

    $object | Add-Member-MemberType NoteProperty - name PG_2_VMotion - value $pg_vmotion_2

    $object | Add-Member-MemberType NoteProperty - name PG_NFS_A - value $pg_nfs_a

    $object | Add-Member-MemberType NoteProperty - name PG_NFS_B - value $pg_nfs_b

    $object | Add-Member-MemberType NoteProperty - name VMot_1_IP - value $vmk_vmotion_IP1

    $object | Add-Member-MemberType NoteProperty - name VMot_2_IP - value $vmk_vmotion_IP2

    $object | Add-Member-MemberType NoteProperty - name VMot_SM_IP - value $vmk_vmotion_SM

    $object | Add-Member-MemberType NoteProperty - name NFS_VLAN128_IP - value $vmk_ipstorage_IP_VLAN128

    $object | Add-Member-MemberType NoteProperty - name NFS_VLAN129_IP - value $vmk_ipstorage_IP_VLAN129

    $object | Add-Member-MemberType NoteProperty - name NFS_SM - value $vmk_ipstorage_SM

    write-output $object

    Code to create the message box...

    $title = "Please verify information."

    $message = ' is the correct information for $hostname?  Do you want to continue? « ;

    $yes = New-Object System.Management.Automation.Host.ChoiceDescription "& Yes", "the information above is correct.

    $no = New-Object System.Management.Automation.Host.ChoiceDescription 'and not', 'Information above is NOT correct.

    $options = [System.Management.Automation.Host.ChoiceDescription []] ($yes, $no)

    $result = $host.ui.PromptForChoice ($title, $message, $options, 0)

    Please see the attached document for the 2 different types of output - 1 correct, incorrect 1...

    Thanks in advance

    The two results are created by different parties.

    When you view $object on the console, it is the release of PowerShell trainer, who knows the objects, product display.

    The 2nd exit, which is missing from the code you gave, but I guess that the $object added you to the $message variable, is produced by the same PowerShell component that manages the output of Write-Host.

    In this case the object is not interpreted, but as it is dumped.

    You can force this 1st output by converting this specific output in [channel].

    Something like that

    .

    $obj = new-Object-property PSObject @ {}

    Field1 = 'abc '.

    Field2 = "xyz".

    Field3 = 'xyz '.

    Field4 = 'xyz '.

    Sphere5 = "xyz".

    Case Field6 = "xyz".

    }

    $title = 'Please check the information '.

    $message = "is correct for information?  Do you want to continue? ' r $($obj |) (Out-String) ".

    $yes = New-Object System.Management.Automation.Host.ChoiceDescription "& Yes", "the information above is correct.

    $no = New-Object System.Management.Automation.Host.ChoiceDescription '& no.","Information above is NOT correct.

    $options = [System.Management.Automation.Host.ChoiceDescription []] ($yes, $no)

    $result = $host.ui.PromptForChoice ($title, $message, $options, 0)

    This will give

  • Script to export information about LUNS - try to iron out the kinks

    I have a script which aims to export the details on the LUN information for the ESX hosts in a particular place. Here's the syntax:

    Report_LUN_Details_Location.ps1 where is introduced in the - position inside the script parameter. The script returns the content in c:\temp in the CSV format. Most of it works, but I have a problem with the path information access which to correctly report. Also, there are errors during execution of the script, but that does not affect the result. There also a few custom fields to communicate their data from EMC Symmetrix devices. Advice on how to improve/correct the script would be more appreciated.

    Thank you

    Ed

    The string error you see is the UUID to local disks is shorter than that of the SAN disks.

    Most of the time these local disks have the word "local" in the displayname property.

    If you can filter them by replacing it

         foreach ($Device in $VMHostObj.Config.StorageDevice.SCSILUN | Where-Object {$_.Vendor -ne "VMware"})
    

    by

         foreach ($Device in $VMHostObj.Config.StorageDevice.SCSILUN | Where-Object {$_.Vendor -ne "VMware" -and $_.DisplayName -notmatch "local"})
    

    The empty DevicePath property is due to disk devices.

    If I replaced this line

         foreach ($Device in $VMHostObj.Config.StorageDevice.SCSILUN | Where-Object {$_.Vendor -ne "VMware"})
    

    by this line

         foreach ($Device in $VMHostObj.Config.StorageDevice.SCSILUN | Where-Object {$_.Vendor -ne "VMware" -and $_.LunType -eq "disk"})
    

    This problem has disappeared.

    BTW, why do you test for vendor VMware?

    Is your set up running on a VMware Workstation perhaps?

    The complete script is attached.

    ____________

    Blog: LucD notes

    Twitter: lucd22

  • Need powershell scripts to collect information from vm disk

    Hello

    I need two scripts to collect information from vm drive,

    1 script to collect information vm disk mode

    Expected results:

    The virtual computer name. Name of ESX. Cluster name | VMDK name | Device label. disksizeInGB | diskmode

    Disc-> Just need the info as persistent or independent_persistent mode

    2. script to collect info RDM of Vm

    Expected results:

    The virtual computer name. Name of ESX. Cluster name | DeviceName | File name | Compatibility mode | Size

    The first script

    Get-VM | %{
         $vm = $_
         $vm | Get-HardDisk | %{
              $_ | select @{N="VM";E={$vm.Name}},
                   @{N="ESX";E={$vm.Host}},
                   @{N="Cluster";E={(Get-VMHost $vm.Host | Get-Cluster).Name}},
                   @{N="VMDK";E={$_.Filename}},
                   @{N="Device Label";E={$_.Name}},
                   @{N="disksizeInGB";E={"{0:N1}" -f ($_.CapacityKB/1MB)}},
                   @{N="Diskmode";E={$_.Persistence}}
         }
    } | ft -AutoSize -Force
    

    ____________

    Blog: LucD notes

    Twitter: lucd22

  • How can I display information message-box on multiple lines?

    I would like to be able to display information from comments in a message of several lines.  I managed to get all the information I need, but I can not format out on several lines. I tried vbNewLine in single quotes, but it still just displays vbNewLine in the box.

    Here's what I have so far (stitched together from code others I found):

    Function Show-Inputbox {
    Param([string]$message=$(Throw "You must enter a prompt message"),
    [string]$title="Input",
    [string]$default
    )
    
    [http://reflection.assembly|http://reflection.assembly]::loadwithpartialname("microsoft.visualbasic") | Out-Null
    [http://microsoft.visualbasic.interaction|http://microsoft.visualbasic.interaction]::InputBox($message,$title,$default)
    
    }
    
    $strVM = Show-Inputbox -message "What is the name if the machine?" -title "Guest Info" -default machine_name
    $vm = Get-VM -Name $strVM
    
    if ($vm.PowerState -eq "PoweredOn") {
    $event = Get-VIEvent -Entity $vm | where-object {$_.fullFormattedMessage -like "Task: Power on Virtual Machine"}
    $VM.Name
    $VM.PowerState
    (Get-VMGuest -VM $VM).IPAddress[0]
    $event[0].username
    }
    
    $strMessageText = $VM.Name+$VM.PowerState+(Get-VMGuest -VM $VM).IPAddress[0]+$event[0].username
    
    $a = new-object -comobject wscript.shell
    $b = $a.popup($strMessageText,0,"Guest Info",1) 
    
    
    

    Does anyone have any ideas on how to do that? Or other ways to display information (in a non-effrayant way for users)?

    In addition, no clue as to how to optimize the code of thise would be apppreciated, it takes time to run.

    PowerShell is a line break ' (backtick + n) n.

    You can do it like this

    $strMessageText = $VM.Name + "`n" + $VM.PowerState + "`n" + (Get-VMGuest -VM $VM).IPAddress[0] + "`n" + $event[0].username
    
  • Need a script to display the hidden field if number = 568845

    Hi all

    Using Acrobat Pro 9.1 on iMac with OS 10.6.8

    I am working on a form to fill out and need a script to display a hidden field when a button is clicked.

    I've set up a numeric field to type a number, and the hidden field is "text1".

    Now, I need a script to the button open only the hidden field, if the field number = 568845

    In this way the customer can fill in the code and then show and type in the field.

    Any help would be appreciated.

    Ron

    Given that you use it by a button, you can't use event.value because a button has no value, and in any case, you want to check the value of another field. So this place like your button MouseUp event (of course, you have to adapt the name of the text field...):

    If (this.getField("Text1").value == "568845") {this.getField ("Hidden_Field") .display = display.visible} else {this.getField('Hidden_Field').

    display = display.hidden}

  • display information in folders root on the table of contents

    RH8 HTML.

    I wonder that if there is a way to define a survey folder in a table of contents to display information, even just a list of subtopics in a main folder of a browser of WEbHelp and air base exit help.

    for example if you look at the help file in RH8, you click on a section of the table of contents at the top level, that is, tables of contents, indexes, glossaries. information appears and indicates what topics are described in this file in the help file.

    I want to do something similar with my help file, even if all the top-level folder, or a subfolder with subtopics just shows nothing until I click on a specific topic.

    hope that's clear, it's hard to explain... but surely a simple solution.

    Thank you.

    Nick

    Hi Nick

    I'm a bit confused as to exactly what you want to achieve here. I think that is a part of the question, you mix the terms files and TOC levels.

    When you automatically create a TOC RoboHelp certainly looks like the folder structure that exists in your project and creates a book for each file it encounters.

    Perhaps you mean ask how you configure books in your table of contents so that a click from the user, not only do they widen to reveal what are the links to topics within the book, but a topic displays on the right side that lists the explanations and links to what's in the book? If this is what you want, you will need to create a topic for each book. Make sure he read and appear as you wish, then use the 'Book with link' function of the table of contents to associate subjects with books.

    See you soon... Rick

    Useful and practical links

    Wish to RoboHelp form/Bug report form

    Begin to learn RoboHelp HTML 7 or 8 days - $24.95!

    Adobe Certified RoboHelp HTML Training

    SorcerStone blog

    RoboHelp EBooks

  • Need a powershell script to gather information from ESX host

    Hello

    I need a powershell script to collect the below given information host ESX to the Virtual Center. My VC:2.5 of the environment, the ESX hosts: 2.5, 3, 3.5

    At present I have individual powershell scripts of a steamer to get these details. Would be more useful to have a single script. I tried VESI, but does not receive the report in the below in the format.

    | ESX host name Version | Number | construction | manufacturer Model | Processor type | Number of physical CPUS | Number of cores | VMotion service IP Console IP | | County HBA | Physical NETWORK interface cards count

    Thanks in advance!

    So I'm at my wits end here.

    It works for me and Robert also confirmed that it worked for him.

    Although I don't see why this would solve the problem, you could finally try an upgrade to PowerShell v2 RTM.

    ____________

    Blog: LucD notes

    Twitter: lucd22

  • Yoga Pro 2 - display not recognized in windows (hardware or driver problem?)

    Out of warranty by a month!

    Yoga Pro 2-256 gb, installed a new wireless card a month ago. Windows 8.1

    The touchscreen still work while the screen is black.

    System restarted after the mode 'sleep', in my opinion.

    The Lenovo logo is displayed, seems to load Windows, but when windows loads (I don't see it so it is a hypothesis of load) drafts of the screen and the black light is on.

    Can I connect an external monintor that connects after the return from sleep mode (odd). Who then off the backlight.

    When the external monitor, the internal screen is not yet recognized by windows.

    When I boot in safe mode, the internal display works fine with of course limited capabilities.

    I rebooted on the support site display drivers.

    Right now my internal monitor is not recognized by windows and is dark, and I can use an external monitor.

    Someone at - he of the clues as to what my happen? Hardware, driver etc?

    Can what information I provide?

    It is a pretty weird problem with contradictory observations.

    (1) screen working in Mode safe but not regular boot. (So not the hardware problem)

    (2) display on an external monitor in normal mode. (So, no drivers issue)

    Have you installed the wireless card yourself? You unplug the cable from the screen during the installation of the card?

    Could you re - open and check that all connections are good?

    The Wi - Fi card works well?

    I also recommend a complete reset of the laptop to eliminate the possibility that it is a corrupt driver. You can use the NOVO button to reset your laptop. Make sure you make a backup on an external drive for your personal files.

  • Script to display the VM who do not respect the rules of the DRS

    Hello

    I'm looking for Powercli script to get some information from DRS rules:

    I explain the details of the bellows of the application

    I have 2 DRS rules:

    The first rule (R1) run several VMS on ESX Details. The ESX name starts with SRV1xxxx... The virtual machine are on data warehouses whose name starts with DTX1_...

    The second rule (R2) run several VMS on ESX Details. The name of ESX starts with SRV2xxxx. The virtual machine are on data warehouses whose name starts with DTY2_...

    For 2 rules above, I need to be sure that VM running on the datastore DTX1, are on servers ESX, named SRV1xxx, then VM that are running on the DTY2 data store, are on the ESX servers named SRV2xxx

    Summary:

    Rule 1: List of virtual machine that runs on DTX1 and SRV1xxxx

    Rule 2: List of virtual machine that is running on DTY2 and SRV2xxxx

    The script should check and view the virtual machines that do not respect the rules. For example, if a virtual computer runs DTX1 and SRV2xxx, or a virtual computer runs on DTX2 and SRV1xxx, I need to put the name of the virtual machines in an excel file and send the result by mail.

    Thanks for your help.

    Kind regards

    Try this variation

    Get - VM |

    Select Name,

    @{N = "Datastore"; E={$_. ExtensionData.Config.Files.VmPathName.Split(']') [0]. "Split('[') [1]}},"

    @{N = "Iddm"; E={$_. ExtensionData.Config.Files.VmPathName.Split(']') [0]. Split('[') [1] - match ' \D+(? \d+)\D+' |) Out-Null; $matches ['number']}},

    @{N = 'ESXi'; E={$_. VMHost.Name}},

    @{N = "ESXid"; E={$_. VMHost.Name.Split('.') [0] - match ' \D+(? \d+)\D+' |) Out-Null; $matches ['number']}} |

    where {$_.} Iddm - not $_. ESXid} |

    Select the name of the data store, ESXi

  • PowerCLI script to display the number of vCPU by VMhost use

    Hi all

    I'm looking to get help here with powerCLI script to list each total number of ESXi vCPU host that is used to determine if there are any ESXi host CPU is more engaged.

    According to suggestion of performance in some blog vExpert, is around 1: 3 of Jepp core ratio: vCPU allocated, then how to display the report with the powerCLI for something like this:

    PRODESXi01
    Total of nuclei available: 32
    Used by the virtual machine: 28

    PRODESXi02
    Total of nuclei available: 32
    Used by the virtual machine: 38

    So according to the result above, the PRODESXi02 is more committed by 6vCPU allocated to the virtual machine.

    Note: The available total carrots is taken from the value of logical processors from the contents tab, when you click on the vSphere console.

    How to get this report using PowerCLI?

    Thank you

    You mean something like this?

    {Foreach ($esx in Get-VMHost)

    $vCPU = get-VM-location $esx | Measure-object-property NumCpu-sum | Select - ExpandProperty sum

    $esx | Select Name,@{N='pCPU'; E={$_. NumCpu}},

    @{N = 'vCPU'; E = {$vCPU}},

    @{N = "Ratio"; E = {[math]: Round ($vCPU / $_.)} (NumCpu, 1)}}

    }

  • Script or command to determine the ESX installation date

    Hello

    I was responsible for getting the date of installation of each ESX host in my infrastructure. Y at - it a script or the cmdlet that is used to determine this information. I have looked around, but discovered nothing. Any help is greatly appreciated.

    G

    As I know there is no property that gives you the installdate.

    There are alternatives, but all do not give a solution that will always return the correct date.

    I prefer to look for the oldest statistical data for the host

    -This requires that statistical data are retained indefinitely

    -If the host has not added to the vCenter immediately after installation, the returned date might be off significantly.

    -due to a bug in the cmdlet Get-Stat, I use the QueryPerf method instead of the cmdlet Get-Stat

    $esx = Get-VMHost MyEsx $perfMgr = Get-View (Get-View ServiceInstance).content.perfManager
    $spec = New-Object VMware.Vim.PerfQuerySpec $spec.StartTime = (Get-Date).AddYears(-2)
    $spec.Entity = $esx.ExtensionData.MoRef
    $metric = New-Object VMware.Vim.PerfMetricId $metric.counterId = 2 $metric.instance = "" $spec.MetricId += $metric $stats = $perfMgr.QueryPerf($spec)
    
    Write-Host $stats[0].SampleInfo[0].Timestamp
    

    The script assumes that it must be less than 2 years since the host was installed, but you can easily change that by changing the setting to the AddYears method.

  • Scripts to get information about the State of health

    Does anyone have examples of scripts that queries an ESXi 4 host for the info on the State of health or the tabs of the condition of the equipment?  I'm looking for something simple (ideally less lines of code) so even if it returns some info about the CPU of the host who would be perfect.

    Thank you.

    The following script displays the status of the sensors of an ESX Server:

    $VMHostName = "YourEsxServerName"
    $HostView = Get-VMHost -Name $VMHostName | Get-View
    $HealthStatusSystem = Get-View $HostView.ConfigManager.HealthStatusSystem
    $SystemHealthInfo = $HealthStatusSystem.Runtime.SystemHealthInfo
    ForEach ($Sensor in $SystemHealthInfo.NumericSensorInfo) {
      $Report = "" | Select-Object VMHost,Sensor,Status
      $Report.VMHost = $VMHostName
      $Report.Sensor = $Sensor.Name
      $Report.Status = $Sensor.HealthState.Key
      $Report
    }
    
  • Script to collect information on an instance of rac oracle / Linux area normal conclusion?

    Hi all
    I have been instructed by the disaster recovery team to get a small quick script of race, to see what oracle instances are in a box, if it is raised, listener is running, etc.

    Normal, only one node instances so far, I've had success. I retrieve the data from the file/etc/oratab and parse try it with awk to get an ORACLE_SID and ORACLE_HOME and.

    This script is run as a user to the dba group, or the oracle so that each instance I try login through SQL * more than connect / as sysdba and not a request to collect information for instance that I echo the screen to determine that the instance is high and connectable.

    The problem I encountered, if there is an instance listed for a node in a RAC cluster... he can't see/etc/oratab entries are quite the same using dbca for RAC nodes as normal nodes.

    For example, say I have a RAC cluster that rac3 and rac1 rac2 nodes.

    From what I see... on the individual nodes, in the/etc/oratab entries only seem to put in for the cluster CCR, rather that say rac1. My script that tries to set the oracle sid and home and connect / as sysdba fails. If the entry has been made there as rac1, it should work, I think.

    Can anyone make any suggestions for me to use with this script, so that I can know which instance of node is running, if CARS is located on the computer... and automatically find and connect similar to how I am doing with the unique databases using/etc/oratab

    Is there a similar to/etc/oratab file that is used by the clusterware on the system?

    Thanks in advance,

    Cayenne

    Published by: cayenne on April 15, 2009 12:57

    Why don't doing by pmon... which I think does not work if she is down but up... you can just run something like:

    ps - ef | grep - v grep | grep pmon | cut '_' f d 3

    or... you could use the oracle_sid you get from oratab (dbname in this case... for example) and run the following:

    srvctl status database-d $sid_from_oratab | grep 'hostname ' | AWK '{print $2} '.

Maybe you are looking for