Script for a specific host info

Hi all

Totally new to powershell/powercli...

Have been out successfully a report to csv format to view the details of ESXi hosts. I know that's not the best scenario, but it does the trick so far.

My question is (as I couldn't find properties for this): can we get information about the DIMM (s) installed on ESXi hosts and add to the script?

Comments are appreciated

$filename = "c:\reports\HostDetails_" + $filedate + ".csv".

Get-vmhost | Select Name, @{Name = "DNS"; {Expression = {$_.NetworkInfo}}, @{Name = 'File'; Expression = {$_.} Parent}}, @{Name = "Standalone"; Expression = {$_.} IsStandalone}}, @{Name = 'ESXi Version'; Expression = {$_.} Version}}, @{Name = "ESXi Build"; Expression = {$_.} Build}}, @{Name = 'Model HW'; Expression = {$_.} Model}}, @{Name = "Processor Type"; Expression = {$_.} ProcessorType}}, @{Name = "Total RAM"; Expression = {[math]: tour ($_.)} (MemoryTotalGB, 0)}}, @{Name = "BIOS Version"; Expression = {$_.} ExtensionData.hardware.biosinfo.BiosVersion}}, @{Name = 'BIOS release Date'; Expression = {$_.} ExtensionData.hardware.BiosInfo.ReleaseDate}} | Export-csv $filename - NoType

The best and most of the time the only way to recover the info is through the interface of the CIM.

Try the attached script (updated the hostname and credentials)...

Tags: VMware

Similar Questions

  • You will need to run the script for some ESX hosts.

    Dear team,

    I m connected to 4 esx host, but I want to run the script only 2 esx host asking you to help me how to do?

    concerning

    Mr. VMware

    You could start the script with the cmdlet Get-VMhost to select only the two hosts that you want to output to. For example:

    Get-VMHost host1, host2. Get - VM

    Displays only the virtual machine running on host1 and host2.

  • Script for a specific virtual machine vmotion

    I play a few trials of benchmarking on VMS 2. part of the test is to migrate a virtual computer when certain I/O points are reached. I wrote a simple script for vmotion one of these virtual machines:

    $vm = get-VM-name Bench_VM | Get-View

    $chost = $vm. $host.name

    If ($chost = ESX01.company.com)

    {

    Move-VM VM - Bench_VM - Destination ESX02.company.com

    }

    on the other

    {

    Move-VM VM - Bench_VM - Destination ESX01.company.com

    }

    I get an error:

    The term 'ESX01.company.com' is not recognized as the name of a cmdlet, function, script file, or an executable program. Check the spelling of the name, or if a path has been included, make sure the path is correct, and then try again.

    What I am doing wrong?

    Thank you

    There are 2 problems with your script.

    (1) you can't get hostname like this

    (2) comparison of PowerShell uses the operator - eq.

    This should work better

    $vm = Get-VM -Name Bench_VM
    $chost = ($vm | Get-VMHost).Name
    if ($chost -eq "ESX01.company.com")
    {
         Move-VM -VM Bench_VM -Destination ESX02.company.com
    }
    else
    {
         Move-VM -VM Bench_VM -Destination ESX01.company.com
    }
    

    ____________

    Blog: LucD notes

    Twitter: lucd22

  • PowerCLI script for join ESXi hosts to Active Directory

    Is there a script that I can run to join the ESXi hosts Active Directory?  I have over 100 guests that I need to join AD and want to add it script instead of using the GUI VC.

    Thank you!

    Matt

    You can browse all of your servers, but you would need to make fully automated, is get the credentials somewhere.

    You have different passwords on all ESXi servers?

    In this case, you could do something like that

    $cred = get-Credential # prompt for user and password

    Get-VMHost | Set-VMHostADDomain -ADJoin:$true -Domain$domain-Credential $cred

    If you do not have the same account/password for all servers ESXi, you want probably asked for each host.

    You could possibly temporarily store in a file and read this file.

    $accounts = @ {}

    Import-Csv "C:\accounts.csv" | %{

    $accounts [$_.hostname] = $_.password

    }

    Get-VMHost | Set-VMHostADDomain -ADJoin:$true -Domain$domain-User root -Password $accounts[$_.Name]

    The CSV file contains 2 columns, called host name and the other called password.

    We read the CSV file and store the passwords in a hash table, where the host name is the key.

    We use the hash table to fetch the password of the Set-VMHostADDomain cmdlet tree.

  • script to stop the vm on the specific host

    I am writing a script to shutdown gracefully all the VMs on a specific host.  I can make it work very well by connecting directly to the host with:

    Get - esx myesxhost-user root - password password

    stop-vmguest *.

    that works really well. But what I want to do is to connect via VC to use accounts AD rather than use root host accounts.

    so:

    to connect-viserver (or get - vc) myvcserver-user me-password password

    stop-vmguest *-Server myesxhost

    makes me an error saying "cannot bind parameter 'server'. Could not convert "myesxhost" to "VMware.VimAutomation.Types.VIServer."

    I looked around and found some info when you are connected to the VC, a host does not count as a "Server" when you use the - Server parameter. Or something like that. I'm new to scripting so apologies if I'm doing it wrong.

    So I tried something that I found on the forum here, where you create a variable for $server that is bound to a host

    $server = get-vmhost myesxhost

    And then I tried:

    stop-vmguest *-Server $server

    and I get the same error as above, including the correct host name. So, I know that I managed to create $server, but apparently this is not the right solution to the problem.

    Help please?

    Thank you!

    You can do it with the right word.

    He stops only customers who are actually turned on.

    Get-VMHost -Name  | Get-VM | ? { $_.PowerState -eq 'PoweredOn' } | Shutdown-VMGuest
    
  • Example of Script for UCCX 8.5 deployment for a scenario of office help

    Hi all

    I'm looking to implement UCCX 8.5 initially for our help desk call center.   I wanted to see if anyone had an example script that I would be able to watch.

    The scenario is an extension of the calling party calls 3333

    The message that you have reached the IT Helpdesk

    Press 1 for a State of the system systems

    Press 2 to speak to a support Office Specialist, if all agents number our busy he would turn outward, outward services.

    Press 3 for more specific support questions.

    Any help would be greatly appreciated.

    This is a high-level script that does what you want.  You would need to change the details of how you want it to work, but this should help you in the right direction.

  • Routing of traffic for a specific user through vpn Ipsec

    I want to route traffic to a specific host on the internet through our external interface (for example, 7.7.7.0/27) instead of the internet connection of the client (for example 9.9.9.9).

    I have already added 9.9.9.9 in the split dns acl so that the road is inserted on the client workstation and a default route on the external interface is defined as follows:

    CISCOASA # run HS | I have the route outside

    Route outside 0.0.0.0 0.0.0.0 7.7.7.30 1

    Nat config

    object obj-InsideNetworks network

    NAT 7.7.7.3 Dynamics (indoor, outdoor)

    No nat

    NAT (inside, all) source static obj-InsideNetworks obj-InsideNetworks destination DEST-Interior-SHEEP inside-DEST-SHEEP no-proxy-arp static

    object obj-InsideNetworks network

    range 10.0.1.0 10.0.255.255

    object-group network inside-DEST-SHEEP

    network-object 10.0.3.0 255.255.255.0

    object-network 10.0.2.0 255.255.255.0

    object-network 10.10.10.0 255.255.255.0

    object-network 10.0.4.0 255.255.255.128

    The static IP assigned to the vpn client is 10.0.4.150 if it is not the scope of the Interior-DEST-SHEEP.  If again I traceroute

    9.9.9.9 when connected, I get the first bond 7.7.7.1 and it stops there.

    Would appreciate any help on this.

    Hello

    If you try to NAT the VPN user traffic when it connects to the Internet through the ASA NAT configuration so that the user should then be

    network of the VPN-CLIENT-PAT object

    subnet 10.0.4.128 255.255.255.128

    dynamics of NAT (outdoors, outdoor)

    Insert the dynamic PAT public IP in the above configuration. You can either use "interface" parameter to use the public IP address of ASAs or insert a detached public IP address that can be used. I guess the Pool of VPN uses the 10.0.4.128/25 subnet.

    You must also make sure you have the following configuration enabled

    permit same-security-traffic intra-interface

    You can check with

    See the race same-security-traffic

    Note that there is another similar parameter that ends in "inter-interface" who used to work for this situation.

    Hope this helps

    Let me know if make you it work

    -Jouni

  • Script for the Configuration DVSwitch

    Hello

    Someone at - it a script for the information of VDS on the level of the host which nic is connected to what uplink?

    Also to remove all Exchange created in the VDS switch for the host and then recreate the exchanges as they were after the connection to the host to a vCenter diff?

    Also any script to copy the resource through VCenter pools?

    Thank you

    Suraj Rawat

    The following script will export information of VDS for uplink, the port they are in and what Teddy is used by node ESXi.

    $report = {foreach ($dvSw in Get-VDSwitch)

    foreach ($esx in (Get-View-id $dvSw.ExtensionData.Summary.HostMember)) {}

    $proxy = $esx.Config.Network.ProxySwitch | where {$_.} {DvsUuid - eq $dvSw.ExtensionData.Uuid}

    $pnicTab = @ {}

    $proxy. Spec.Backing.PnicSpec | %{

    $pnicTab.Add ($_.) UplinkPortKey, $_. PnicDevice)

    }

    $proxy. UplinkPort |

    Select @{N = "vdSwitch"; {E = {$dvSw.Name}}.

    @{N = "$vmhost"; E = {$esx. Name}},

    @{N = "vNIC"; E = {$pnicTab [$_]} Key]}},

    @{N = "Uplink"; E={$_. Value}},

    @{N = 'Port'; E={$_. Key}}

    }

    }

    $report | Export Csv C:\dvSw-Uplink.csv - NoTypeInformation - UseCulture

  • How to add permissions for a specific to multiple ESX Servers AD account

    Hello

    I would add host authorization for a specific to about 100 guests ESXi AD account.

    I could add the authorization for a single host.

    SE connect-VIServer ESXihostname

    New-VIPermission-role role - main ADAccountname - entity ESXhostname

    Disconnect VIServer ESXihostname

    Now I need to run this in a loop of 100 servers

    Help, please.

    You can try with the SDK method?

    $esxName = "MyEsx".

    $adName = "domain\user".

    $roleName = "Admin".

    $esx = get-VMHost-name $esxName

    $authmgr = get - see $esx. ExtensionData.Client.ServiceContent.AuthorizationManager

    $perm = new-Object VMware.VIM.Permission

    $perm. Main = $adName

    $perm.group = $false

    $perm.propagate = $true

    $perm. RoleId = $authmgr. RoleList | where {$_.} Name - eq $roleName} | Select - ExpandProperty RoleId

    $authmgr. SetEntityPermissions($esx.) ExtensionData.MoRef, $perm)

  • How can I make the page of form for the Yahoo host?

    How can I make the page of form for the Yahoo host?

    I guess you want a contact form that sends data to your e-mail account.

    1. Find out if your hosting plan supports PHP code and the PHP mail() function.
      If so, try this tutorial into 3 parts:
      ALT-Web Design & Publishing: sensitive Contact form with 3.2 Bootstrap and PHP (part 1)
    2. If your hosting plan does NOT support scripts, you will need to use a 3rd party like Wufoo.com service.  They host the form processing scripts on their own servers for you.

    Nancy O.

  • How to force use of the VM a specific host in a cluster?

    I use vSphere vSphere Web Client 5.5 thru 5.0U2.

    When I create a virtual machine, I specify a host in a cluster as computing resources.  However, when I turn on the virtual machine, it uses another host.   How can I configure the virtual machine to use only a specific host in the cluster?

    Use the DRS-> Virtual Machine Options to disable the level of automation for the virtual machine. Who will be actually anchor her to this host. You could also put the VM on local storage or attach too to a resource (DVD-ROM) on this host, but the road of the DRS is the best way to go.

  • Paths multiple settings for a specific LUN

    Hello

    I'm a workflow in Orchestrator automatically add a new data store in a cluster.

    This set works but I have set the parameters of Multipath for this specific to Round Robin on each host LUN.

    I created the code that affects all LUNS Round Robin, but it must be for this specific LUN only.

    Can someone help me with this?

    It's the current code I have:

    var mpp = new VcHostMultipathInfoLogicalUnitPolicy() ;
    mpp.policy = "VMW_PSP_RR";
    
    for each (var host in hosts) {
      for each (var lun in host.config.storageDevice.multipathInfo.lun) {
      var id = lun.id;
      host.configManager.storageSystem.setMultipathLunPolicy(id, mpp);
      }
    }
    

    I have the "naa", so I can do the check, but I can't do the "naa" of the multipathInfo.

    I tried to use:

    lun.lun.displayName

    lun.lun.canonicalName

    lun.lun.deviceName

    But it gives 'undefined' output

    Example of output:

    [11:12:18.346 2013-12-27] [D] LUN.id: 020003000060050768018086e430000000000003f1323134352020

    [11:12:18.346 2013-12-27] [D] LUN. MON: key - vim.host.ScsiDisk - 020003000060050768018086e430000000000003f1323134352020

    [11:12:18.346 2013-12-27] [D] LUN. LUN.displayName: undefined

    [11:12:18.346 2013-12-27] [D] LUN. LUN.canonicalName: undefined

    [11:12:18.346 2013-12-27] [D] LUN. LUN.deviceName: undefined

    Hello

    I can't get the details that you listed at the bottom of your message, too!

    But when you have a quick glance at the LUN ID you extracted, you can see that the naa.XXX is included in there.

    So I think it should be possible to extract this number, here is a small example of my environment:

    Lun.ID = 0200bf000060060e8016546b000001546b00006abf4f50454e2d56

    NAA = naa. 60060e8016546b000001546b00006abf

    Extraction:

    var myNaa = lun.id.slice(10,42);
    System.log("My Naa: naa." + myNaa);
    

    In your code, it might be something like this:

    var mpp = new VcHostMultipathInfoLogicalUnitPolicy() ;
    mpp.policy = "VMW_PSP_RR";
    for each (var host in hosts) {
      for each (var lun in host.config.storageDevice.multipathInfo.lun) {
        var id = lun.id;
        var myNaaExtract = lun.id.slice(10,42);
        if(myNaaExtract.search("60060e8016546b000001546b00006abf")!= -1) {
          System.log("Found the matching NAA...");
          host.configManager.storageSystem.setMultipathLunPolicy(id, mpp);
        }
      }
    }
    

    You may need to change the 'slice' to correspond with your table (using other numbers 10 and 42) and of course online 7 "id naa".

    I hope this helps for you...

    Kind regards

    Marc

  • Scripts for indesign

    Hi all.  I wonder if there is a script for indesign that allow me to put the file name / and identifiers of color at the bottom of the Document.  Also, who will all place me information where I want.  For ex...   I want to send a task to plates and rather than manually enter the name of the file - Date and time - and colors on the bottom of the plate/file.  I know that when I go to export a file or print a file it is check box to put the information on the file page and it does what I want however he put the information too low on the plate.  He added the information down into the corner of the plate area and receiving not Burnt or processed in this area.  I need a script to back up the information, if we read.

    Hi cbishop01,

    First of all, I would not recommend research by sending your files to Indesign as postscript, if your normal process is a PDF workflow. PostScript does not support some features on various output devices. When the postscript from Indesign, you can run into CMYK printing issues when dealing with PDF files and other works of art that contain some transparency effects and mixing modes that cannot be interpreted by the postscript or cannot flatten properly.

    My employer uses a script Indesign, we have developed which can be something similar to what you are looking to accomplish. If your plate is always the same size, you can create a model of tax file in Indesign with job info, color chart, date and time, and you want to integrate the model tax. You can use a script Indesign to automatically update the model every time that you print in PDF format (which can be done by adding a custom ease menu item).

    Plate files vary from a file in a file, you can convert the file name, time, blocks of color name text in an Indesign library item and drop it right in the position desired on each individual plate installation. You will not have to change these items, you will only place a group element where you want to go.

    Is this something that will work for you?

    (example of a model of plate file)

    (example of slug color library item)

  • How to disable vCenter opens a session for a specific user?

    Hello
    I need to know how to disable the log in vCenter 5 for a specific user.
    Thank you

    Hi Tim,.

    If you use Joulex Energy Manager 3.0.4 or above, you can change the way Sensordata is extracted from SOAP on CIM - please follow the instructions at http://download.joulex.net/doc/3.0.0/html/pages/en/#general/ac/ac_vmware, for example to define the extended property vmware.usegwt = 1 in your vmware hosts.

    Best regards

    David

  • advice of script for a beginner please

    I am a beginner, trying to enter VMware (winding maze lost in corridors...)

    With vSphere Client I can manually create virtual machines on our 5 ESXi host, producing an OVA of our product for distribution file.
    I am obliged to describe the process.

    Can I set up and configure virtual machines using only the ESXi console?

    VCLI (free download) allows Windows to create virtual machines on an ESXi host?

    Outline of what needs of script:

    • create a VM (this is the only bit that I was able to do it, using the console for ESXi)
    • install CentOS Linux using anaconda with kickstart script
    • Configure the virtual machine and the export

    Advice, tips or pointers to get this done will be very appreciated!

    Thank you very much

    Alan

    A few answers to your questions

    1. you will need to get an ISO of the CD of CentOS and store it somewhere on a data store.

    Once this is done, you can use the cmdlet Set-CDDrive with the IsoPath parameter.

    2. use the cmdlet New-VM , something like that.

    You get the default value of the bu NIC, just specify what portgroup to connect to

    $vm = New - VM - name MyVM - ID centosGuest - NumCpu 1 - MemoryMB (1 GB / 1 MB)-DiskMb (60 GB / 1 MB)-NetworkName MyPG

    3 see forces a VM to access BIOS screen on the next reboot

    4. use the Start-VM cmdlet

    Start-VM - $vm VM - confirm: $false

    5 once again with the cmdlet Set-CDDrive , but the use of the HostDevice parameter

    6 see specify bootable for a virtual machine devices

    7. do not apply. You change the boot order before starting the virtual machine

    8. who could perhaps be done with the Invoke-VMScript cmdlet and the bash ScriptType parameter. But I have not tested with CentOS.

    9. it's a little tricky. The external vSphere unclear when a program inside a guest what OS is finished. There are ways to send some kind of semaphores, see, for example, waiting for the customization of the OS to complete

    10. There are a lot of the cmdlet Set-availabe, i.e. Whole-VM, Set-NetworkAdapter...

    As a guideine, you should always try to translate your literally to scripts for automation of manual procedures. Sometimes, you should first rethink your account automation procedure.

Maybe you are looking for

  • 12 Firefox flash player not working not not with Facebook video

    Use Firefox 12, more recent flash player 32-bit - embedded video does not work on Facebook. I tried another computer with XP SP3, completely deleted firefox, flash, started in safe mode with Add ons disabled, even created a new profile with no addons

  • send a multi page fax

    When I try to send a fax to multi page I put the pages printed side upwards in the sandbox until I hear the tone, press fax.  It then passes through the composition in no time I'm getting print fax confirmation has been sent, only complaint is the pa

  • HTMLText links does not

    I was wondering if the HTMLText links are supposed to work again?  I have a link in the HTMLText property of a label with a stylesheet attached to it.  It visually makes the way I expect, but it is not clickable.  Or if it does nothing when I click o

  • Lightroom 6 (not CC) does not start after the upgrade of the LR5

    Hi, first of all, I don't use CC.I upgraded my copy of Lightroom 5.7 last week and used LR6 for about 2 days before this problem started. I opened LR6, the splash screen appears and nothing else happens. The Task Manager shows LR6 does not, and no am

  • How to add css on board

    HowdyEA 1.0I'm looking for a site that will show you that the different ways you can add CSS to an object on board.Found this code on a site...SYM. $(manOne) .css ({"width": "275", "height": "280"});Found this code on another...SYM. $(manOne) .css ({