Save the CDP to HTML for Mulitple VMHosts via PowerCLI

Hello

I tried some of the existing scripts found here to collect information network switch port CDP natachasery on ESXi hosts.  These scripts assume that a host is queried or they connect to a server vCenter Server to collect a VMHost list.  When I try to connect to multiple ESXi hosts, that I will meet this error:

The method call failed because [System.Object []] contains a method named "QueryNetworkHint".

Can a PowerCLI script perform the next task?

I wish that the script first to connect to multiple ESXi hosts that are not managed in vCenter.  The default Mode of the Get-PowerCLIConfiguration server has Multiple value so that "Get-VMHost" returns a list of the VMHosts.

The script would then collect information from each bear on each host and export the results to the format of HTML table as shown in the example attached .htm.  I hope help with the section which gathers information for multiple ESXi hosts.

# Begin script

SE connect-VIServer esx1-user user1-password password1

SE connect-VIServer esx2-user user1-password password1

SE connect-VIServer esx3-user user1-password password1

$filename = 'C:\ www\cdp_example.htm.

???

# Example of data

$report = @)
$row = "" | Select VMHost, vSwitch, physNIC, PortID, VLANID, speed, Devanlay, MAC

$row. VMHost = "esx1.example.com."

$row.vSwitch = 'vSwitch0.

$row.physNIC = "vmnic0".
$row. DFR = "switch1.example.com."
$row. PortID = "GigabitEthernet3/5.

$row. VLANID = "101".

$row. Speed = "1000".
$row. MAC = "00: 0C: a3:4 b: ff: 01»

$report += $row

$report | ConvertTo-Html-title "ESXi CDP Info | Out-file $filename

--

Sample HTML table output.

VMHost vSwitch physNIC DevID PortID VLANID Speed Double-sided MAC
Esx1.example.comvSwitch0vmnic0Switch1.example.comGigabitEthernet2/41011000Full00: 0C: a3:4 b: ff: 01
Esx1.example.comvSwitch0vmnic1SWITCH2.example.comGigabitEthernet3/51011000Full00: 0C: a3:4 b: ff: 02
ESX2.example.comvSwitch0vmnic0Switch1.example.comGigabitEthernet3/51011000Full00: 0C: a3:4 b: ff: 03
ESX2.example.comvSwitch0vmnic1SWITCH2.example.comGigabitEthernet3/51011000Full00: 0C: a3:4 b: ff: 04

--

Thank you!

Try to change this line

$netSys = get-view $esx.ConfigManager.NetworkSystem

in this

$netSys = get-view $esx.ConfigManager.NetworkSystem - Server $esx

Tags: VMware

Similar Questions

  • How can I track the progress of download (for update Iphone via iTunes)?

    How can I track the progress of download (for update IPhone via iTunes)?

    To the right of your account towards the top right of the program name, you'll see a mobile circular icon. Click on that and you will get a dialog box indicating the progress.

  • Is it possible to save pieces of code html for easy insertion

    I have used arachnophilia for my html for many years

    It allows me to record pieces of commonly used html and simply click to insert in a page if necessary

    However it is therefore more appropriate to arachnophilia

    Edge code has no way to save commonly used for fast inclusion code blocks

    Here is an example that I use all the time. Much easier to save this and simply click rather than rewrite whenever I want to use

    < META NAME = "robots" content = "follow, index" >

    < META NAME = 'distribution' CONTENT 'Global' = >

    < META NAME = "revisit-after" CONTENT = "1 day" >

    < name meta = "googlebot" content = "all" / >

    < name meta = "msnbot" content = "all" / >

    < name meta = "yahoobot" content = "all" / >

    < META http-EQUIV = "Author" CONTENT = Inc. CanLaw ">"

    < name meta = "copyright" content = "canlaw.com" >

    < name meta = "Robots" content = "ALL" >

    < = happy ' rating' meta name = "Général" >

    Edge code is a re-branding of media (http://brackets.io), so that you can install any extension brackets (https://brackets-registry.aboutweb.com/) in the edge Code. Use file > extension manager... to install the extensions.

    I think that the extension of excerpts from media makes you want.

    Randy

  • I downloaded and installed successfully the CS6 and Lightroom for my desktop via a subscription to the CC but would now install the same on my laptop but cannot find how do... Gary

    I downloaded and successfully installed CS ^ and Lightroom for my desktop via a creative cloud subscription. I now want to install the same on my laptop. but could not find the means to do so... gary

    All you need to do is install Adobe Creative Cloud application using which you can download the CC apps.

    https://creative.Adobe.com/products/creative-cloud

    Reference:

    https://helpx.Adobe.com/creative-cloud/help/install-apps.html

  • Connect the Local ISO Image drive to VM via PowerCLI

    Hi all

    I want to connect my CDDrive Office or an ISO Image from my Local hard drive to the OS ESX VM guest by PowerCLI.

    Please tell me the command or script for above scenario.

    Thanks for your replies in advance.

    Kind regards

    Foudil

    Hi Kevin,.

    I made an example to show how you can copy the iso file to a data store, and then plug it into the CD drive on the virtual machine:

    $Datastore = "Storage1"
    Get-Datastore $Datastore | New-DatastoreDrive -Name ds
    New-Item -Type Directory -Path ds:\ISOfiles
    Copy-DatastoreItem -Item d:\pv\0.iso -Destination ds:\ISOfiles\0.iso
    Get-VM -Name SDGRP008 | Get-CDDrive | `
    Set-CDDrive -IsoPath "[$Datastore] ISOfiles\0.iso" -Confirm:$false
    

    Best regards, Robert

  • Error in creating the body of HTML for Email with attachment

    I have an application where I send emails with an attachment. It seems to work very well. I'm now add content to the body of the Email and I'm running on about how set up the body. To test, I created a small amount of html code which is placed in part p_body_html of the script send mail, but because it's going to be a little (more than 1000 characters) to create the real html table, I'm trying to create in a declared variable and then have the p_body_html call the variable l_body_html and that's where I'm running into the following error message :

    1 error has occurred
    * ORA-06550: line 9, column 9: PLS-00307: too many statements of 'SEND' fits this call
    ORA-06550: line 9, column 1: PL/SQL: statement ignored

    Code that works is:
     
    DECLARE
        l_id NUMBER;
        l_body_html CLOB;
    BEGIN
    l_id := APEX_MAIL.SEND(
            p_to        => :P4_TO,
            p_from      => '[email protected]',
            p_body      => 'Please review the attachment.',
            p_body_html => '<html><head></head><body><table width="615" border="0" align="center" cellpadding="0" cellspacing="0" RULES=NONE FRAME=BOX style="cellpadding:0 cellspacing:0"><tr><td height="32" colspan="2" bgcolor="#FF0000">Information</td></tr><tr><td colspan="2">Testing</td></tr><tr><td>One</td><td>Two</td></tr></table></body></html>',
            p_subj      => :P4_TITLE);
    FOR c1 IN (SELECT filename, attachment, mimetype 
            FROM ATTACH_EMAIL
            WHERE recordid = :P4_recordid) LOOP
    
            APEX_MAIL.ADD_ATTACHMENT(
                p_mail_id    => l_id,
                p_attachment => c1.attachment,
                p_filename   => c1.filename,
                p_mime_type  => c1.mimetype);
            END LOOP;
        COMMIT;
    END;
    The code that does not work is:
    DECLARE
        l_id NUMBER;
        l_body_html CLOB;
    
    BEGIN
    l_body_html :='<html><head></head><body><table width="615" border="0" align="center" cellpadding="0" cellspacing="0" RULES=NONE FRAME=BOX style="cellpadding:0 cellspacing:0"><tr><td height="32" colspan="2" bgcolor="#FF0000">Information</td></tr><tr><td colspan="2">Testing</td></tr><tr><td>One</td><td>Two</td></tr></table></body></html>';
    
    l_id := APEX_MAIL.SEND(
            p_to        => :P4_TO,
            p_from      => '[email protected]',
            p_body      => 'Please review the attachment.',
            p_body_html => l_body_html,
            p_subj      => :P4_TITLE);
    FOR c1 IN (SELECT filename, attachment, mimetype 
            FROM ATTACH_EMAIL
            WHERE recordid = :P4_recordid) LOOP
    
            APEX_MAIL.ADD_ATTACHMENT(
                p_mail_id    => l_id,
                p_attachment => c1.attachment,
                p_filename   => c1.filename,
                p_mime_type  => c1.mimetype);
            END LOOP;
        COMMIT;
    END;
    I said the l_body_html as CLOB then I fill it with code and then I reference it the p_body_html. I have this work under other forms of e-mail with no attachments and it works fine. Don't know how I have too many statements as the error States and would appreciate any help

    Thank you
    Wally

    Hi Wally,

    The SEND() function may take varchar2s or CLOB to p_body and p_html_body. In your code, you declare l_body_html as a CLOB, but assigning a string. It is possible that the database is confused?

    Try to use TO_CLOB ('...') to set the value of l_body_html

    Andy

  • How to find and save the utilities and drivers for Satellite Pro M10?

    OK, so last time I formatted I not able to find the recovery discs and installed WXP Pro from a CD, there to remove the OEM on the virtual partition! Then spent hours to find the right drivers, etc..

    Is there a way easy to find and backup drivers and utilities that I need for my system before I have format the HD?

    Hello guy

    I don't know what model of laptop you have and how old there but everything you need you can download from the Toshiba support page under http://eu.computers.toshiba-europe.com support & downloads.

    If you have any other questions, please write again.

  • Can Vista - I save the updates already installed for the reinstallation of Vista?

    I want to completely reinstall my computer - destructive recovery or something, I think it is called. Can I record the existing updates on a disc or flash drive, so I have to download all over again? There are about 600 MB of them, so I wouldn't have to download them again.

    PS - I've just seen that it is a forum for Win 7? I'm on Vista, not Win 7. Thank you.

    Agios

    start all over again.  but one of the ways are here

    http://social.answers.Microsoft.com/forums/en-us/vistawu/thread/a4aed215-D236-4DA7-8292-81f8d3605976

  • Licenses for the software HP Smartscan for mulitple devices

    Dear Forum,

    I have an old 7800 scanner that I want to share (with a USB switch), will it take additional licenses for the Smartscan software for other devices? - and if so please could provide you a room code I can order.

    Thank you very much.

    No, you will not have a license for the software SmartScan. You may not be able to share scanners, however. You can try to see, but you will not have an additional license or nothing.

  • I forgot the PIN to save the files to sign for API access controlled

    My completed purchases of companies service the online form for purchase of signature files. They forgot to note the 10 PIN number that was used to fill in the form. Now, I'm not able to use the API. Is there a way to get the PIN.

    Contact [email protected]

    provide details of your purchase (date, title company, etc.) and ask them to send the pin code to the email address registered on the buying process.

  • How can I save the eps AI CS4 for a 3rd party with CS3 file when my previous version was CS?

    I think I'm supposed to make a "Save as", but when I do that, I'm unable to select CS3 in option, given that my previous version was CS. Any help would be greatly appreciated!

    File > save as. Choose EPS, and then click Save. Version will be on the next screen. But if you send the file to a user of Illustrator, is a format better. Smaller.

  • Rebuild the indexes to search for Windows 7 via command line

    My search index is constantly becomes corrupted and will have problems, looking for things in Outlook. The only way I can make it work temporarily is rebuilt the index and it goes for a week or two before she starts to have problems again.

    Is it possible that I can have research rebuilt via command line so that I can put in a batch file and schedule it to run?

    off @echo
    net stop wsearch
    del "% programdata%\microsoft\search\data\applications\windows\Windows.edb.bak".
    move "% programdata%\microsoft\search\data\applications\windows\Windows.edb" "% programdata%\microsoft\search\data\applications\windows\Windows.edb.bak".
    net start wsearch

  • Where should I save the profile of calibration of camera for Lightroom 2?

    I created a few DNGS through DNG Profile Editor camera profiles. For the calibration of camera in Camera Raw, I save these files .dcp in C:\ Administrator\ Documents and Settings\ Application Data\ Adobe\ Camera Raw------CameraProfiles. However, I could ' t find such a subfolder in the folder Lightroom, we know where should I save the files from STC for Lightroom 2? Thank you

    This is the same installation folder for Camera Raw and Lightroom (i.e., a .dcp installed in the folder you have described will be readable by the CR and LR).

    Eric

  • LabVIEW prompts you to save the vi during the closing of the reference

    In our application, we - open reference vi - find its executing state - the closing vi reference. In closing, LV prompts you to save the vi, how to avoid it. I can see option to activate the guest of LV, but no option to skip. 0x20 for now allows us to avoid the load dialog box.

    We appreciate your comments

    Thank you

    SAS

    Looks like when leaving the possibility to 0x0 or using any other option other than 0 x 4, should not prompt the user to save the file. But for some reason, I met the guests user to save the file... Don't know why! but I got the solution now :-)

    It will be good to know why I got the guests even for option 0 x 20!

    Thank you

    SAS

  • Can Windows Defender updates - I save the updates to a flash drive to install on another computer?

    Windows Defender updates can be downloaded on a flashdrive on another computer and then transferred to another computer?  I still have remote access and it took 5.5 hours to download the most recent, then it would not install.  I am running Windows XP Pro.

    Try to SAVE the file called here for a flash drive and then running on the other computer.

    http://support.Microsoft.com/kb/923159

Maybe you are looking for

  • PCI-7833R replacement

    I want to replace my card PCI of FPGA 7833R with new and better FPGA and the PCIe bus if possible.  I want to make little changes to the LabVIEW code as possible, but I notice the potential changes that I have so far.  Are there ways to get around th

  • How to use the password protected sharing printers

    Original title: printer sharing   Dear Ant experts: Would that sharing a printer from a PC (win 7) a user has to an another PC (XP) used B, the user shared this printer (HP) to the public, with the user everyone add and enable all managed features. P

  • Upgrade to Vista Home premium

    I bought a vista Home premium 32-bit update. It says on the box upgrade of Service Bureau, I never used it until yesterday. I ran the disc 1, when he was done he asks disc 2 which I did not, I must have lost over the years, is there a place to get th

  • link to Facebook icon attached to outgoing emails in Windows Live Mail 2012

    Hello I would like to add a Facebook icon to all my emails outgoing (I have windows Live Mail 2012) so that when it is "clicked on" by the recipient of the email he links directly to my facebook page. How this is done?

  • icon does not appear in the Simulator

    Hi all I developed a Java midlet application in Blackberry file in Eclipse 3.6.0 and it works Simulator Blackberry 9800. However, the icon that appears in the Simulator is a default icon for BB but not the icon that I have included in the res img fil