help power shell VM information

Hello

I need assistance with my shell script which makes me the name of the virtual machine, the processor, the memory and the host.
I back everything except the host, I have the following exception.

'Point': "Exception from HRESULT: 0x800A03EC.
C:\temp\ESXtest.ps1 level: character 29: 18
+ $Sheet.Cells.Item < < < < ($intRow, 7) = $objItem.Host
+ CategoryInfo: NotSpecified: (:)) [], SetValueInvocationException)
+ FullyQualifiedErrorId: CatchFromBaseAdapterParameterizedPropertySetValueTI

the script

SE connect-VIServer-server iron - statistics of username-password 123

$Excel = new-Object - Com Excel.Application
$Excel.visible = $True
$Excel = $Excel.Workbooks.Add)
$Addsheet = $Excel.sheets.Add)
$Sheet = $Excel.WorkSheets.Item (1)
$Sheet.Cells.Item (1,1) = 'name '.
$Sheet.Cells.Item (1,2) = 'NB CPU.
$Sheet.Cells.Item (1,3) = '(MB) of memory.
$Sheet.Cells.Item (1.4) = "ProvisionedSpaceGB".
$Sheet.Cells.Item (1.5) = 'Notes '.
$Sheet.Cells.Item (1.7) = "$vmhost".

$WorkBook = $Sheet.UsedRange
$WorkBook.Font.Bold = $True
$WorkBook.EntireColumn.AutoFit)
$intRow = 2

$colItems = get - VM | Select-Object 'name', 'NumCPU', 'MemoryMB', 'ProvisionedSpaceGB', 'Notes', 'Home'
foreach ($objItem to $colItems)
{
$Sheet.Cells.Item($intRow,1) = $objItem.Name
$Sheet.Cells.Item($intRow,2) = $objItem. "" NumCPU.
$Sheet.Cells.Item($intRow,3) = $objItem. "" MemoryMB.
$Sheet.Cells.Item($intRow,4) = $objItem. "" ProvisionedSpaceGB ".
$Sheet.Cells.Item($intRow,5) = $objItem. "" Notes ".
$Sheet.Cells.Item($intRow,7) = $objItem.Host
#foreach ($objItem in $colItems)

$intRow = $intRow + 1
}

# $powerstate = $objItem.PowerState
# If ($PowerState - eq 1) {$power = "Powerd on"}
# Else {$power =? {Powerd off?}


Disconnect-VIServer-confirm: $false

Hello

Please try to change this line

$Sheet.Cells.Item($intRow,7) = $objItem.Host

This line

$Sheet.Cells.Item($intRow,7) = $objItem.Host.Name

Greg

Tags: VMware

Similar Questions

  • Need help with some cluster power shell scripts

    Guys,

    I need help with 2 scripts.

    Text 1.

    I need a power shell script that will get all the virtual machine in a specific cluster.  Virtual machine names as well as the number of processors, output allocated RAM and size of CSV file.

    Text 2.

    I need a script that will get all data warehouses in a specific cluster and store name data as well as the amounf of free space for a CSV output.

    Thanks in advance guys.

    Greetings, @peter79 -.

    For the first part:

    Get-Cluster myClusterName | Get-VM | Select-Object Name, MemoryMB, NumCpu | Export-Csv -NoTypeInformation c:\temp\myVMInfo.csv
    

    And for the second, how about:

    Get-Cluster myClusterName | Get-VMHost | Get-Random | Get-Datastore | Select-Object name, FreeSpaceMB, CapacityMB | Export-Csv -NoTypeInformation c:\temp\myDaterstoreInfo.csv
    

    The first would be quite a bit faster by using Get - view instead of Get - VM.  It would be like:

    ## get an array of VM View objects with just the desired/needed properties
    $arrVMViews = Get-View -ViewType VirtualMachine -SearchRoot (Get-Cluster myClusterName).MoRef -Property Config.Hardware,Name
    ## make the two filters for displaying the desired info
    $hshCPUCountFilter = @{n="NumCPUs"; e={$_.Config.Hardware.NumCPU}}
    $hshMemAmtFilter = @{n="MemoryMB"; e={$_.Config.Hardware.MemoryMB}}
    ## display the info, and export to CSV
    $arrVMViews | Select-Object name, $hshCPUCountFilter, $hshMemAmtFilter | Export-Csv -NoTypeInformation c:\temp\myVMInfo.csv
    

    Enjoy.

  • How can I remove "Microsoft Power Shell", that was installed when I downloaded 'Mr Fixit' this program was not helpful, an it took all of my memory.

    I have now finally deleted the various stages of 'Mr Fixit' because it wouldn't work. He said that as it was not supported by my computer it couldn't work.

    However "Power Shell" does not allow me to remove it until I have reinstall 'Mr Fixit' but I don't want to do that, then there must be another way I can remove "Power Shell.

    Hey t-932 Michael,.

    You have it given a try? Let us know if you got it resolved or need support.
    Thank you!
  • What is windows power shell

    I noticed windows windows power shell and shell what ISE has installed on my computer. What is this program?

    Help & Support:

    For more information about Windows PowerShell, go to the next
    resources on the Microsoft Web site:

    • Windows PowerShell Blog.
      The best resource to learn and work with other windows
      PowerShell users. Read the Windows PowerShell blog and join the windows
      Forum (microsoft.public.windows.powershell) PowerShell users. Use Windows Live
      A search to find other Windows PowerShell articles and resources. Then, as you
      develop your expertise, freely contribute your ideas.

    • Windows PowerShell help on
      TechNet
      . An updated release of the Windows PowerShell Help topics on
      Microsoft TechNet.

    • Windows PowerShell SDK.
      Provides reference content used to develop cmdlets command, suppliers and host
      applications.

    • Windows PowerShell
      Programmer's Guide
      . Provides tutorials for creating cmdlets, providers, and
      host applications. Also contains information on basic Windows
      Concepts of PowerShell.

  • POWER SHELL WILL NOT INSTALL ON COMPUTER USING XP PROF.

    PRINTER WON'T INSTALL ITS COIL POOL-ER DOES NOT WORK
    SO I CK IN Mr. FIXER AND POWER SHELL not to CHARGE not

    You need this and its updates .

    It tells you about the site, what are the requirements

  • Popup Windows LIve Mail Message to help protect your account information, please sign once again

    Windows LIve Mail Massege

    Pop-up message to help protect your account information, please sign once again

    Hello

    You will need to create a post on www.windowslivehelp.com for questions and assistance in connection with the Windows Live programs and services.

  • I can't find any help to fix my information bar in Windows Mail. It's like a split screen display.

    I can't find any help to fix my information bar in Windows Mail. It's like a split screen display. A suspected email "phishing" shows the warning in pink on the left side but right, I can still see the partial list of the names of "recipients" email & addresses. The button to unlock does not at all. There is no error message and it started 2 days ago. Do I need to reinstall the program, and if I do, could you provide me with information on how to configure Windows Mail once more.

    Thank you!

    Windows Update forced the installation of IE 9, and that's why you see the problems.  See www.oehelp.com/OETips.aspx#15 for workarounds.

    Steve

  • Need examples and a reference link of combat in the setting of the project, videos and tutorials did not help me much more information

    Need examples and a reference link of combat in the setting of the project, videos and tutorials did not help me much more information.

    Can you tell me or explain myself better. I'm new to using this new trial of DPS

    Thank you

    The option "Link reference" in the project settings can possibly be used for a link to an application from outside of the app, but it is currently not supported. You can learn more about this option and other parameters of the project here: Digital Publishing Solution help | Create projects

    If you are looking for ways to create links to other articles, see the following: hyperlinks in 2015 of DPS.

    Let us know if you have any other questions.

    -Bob

  • How to manage the VM Ware Infrastructure using Wnidows Power Shell

    Hello

    can any one post any pdf/blog link etc. which can learn to manage the VM Ware Infrastructure using Wnidows Power Shell, bases of the.

    If anyone has the link to the pdf or pdf itself, please share.

    VMware with Windows PowerShell TFM [PIN] infrastructure management

    http://www.Amazon.com/Managing-VMware-Infrastructure-Windows-PowerShell/DP/0982131402

    Thank you

    Ashish

    Hello

    Luke describe.

    Window Powershell is installed in windows server 2008 and above. For other MS operating systems, you can download it from the microsoft support site.

    Can VMware PowerCLI you find here

    https://my.VMware.com/Web/VMware/details?ProductID=285&downloadGroup=VSP510-pcli-510

    Frank

  • Compaq Presario SR1522X HELP power switch!

    Help! For the life of me, I can't understand the switch on the front panel. How the hell does it work? My switch will not turn on the computer. I took the front panel off, and I'm completely baffled works even in the switch. Any help would be appreciated.

    Thank you

    Fred

    Hello @Fred_W,

    I understand that your switch does not work and you need assistance. I provide you with a guide on how to make sure it is plugged properly below:

    Step 1. What is the power switch.

    The power on / off switch and the hard disk activity and turn on the LEDs are contained in a single module.

    Step 2. Where is the switch?

    The module is mounted behind the wall front of the chassis.

    Step 3. How is the power switch set to the chassis?

    3 hooks on the module to fix to the wall of the chassis.

    Step 4. When the power switch is connected to the motherboard?

    I hope that this information helps to answer your question. Given the age of the computer HP is no longer wearing the power switch so if it needs to be replaced, you will need to find a 3rd party distributor. An online search, or possibly a local computer technician must be able to locate the part for your.

    Thanks for posting on the HP Forums. Have a wonderful day!

  • Windows update error ox80070020, cannot install power shell update vista Home premium

    Windows vista Home premium, windows update to PowerShell will not be installed via updater. I use microsoft security databases.

    Hello

    Have you made changes on the computer before this problem?

    I suggest you try the following Microsoft article and check if it helps.

    Method 1:

    Run the fixit in the following Microsoft Fixit article and check if it works.

    The problem with Microsoft Windows Update is not working:

    http://support.Microsoft.com/mats/windows_update/

    Method 2:

    Try the steps in the Microsoft article and check following.

    You receive the error 0 x 80070020 when you use the Windows Update Web site or the Microsoft Update Web site to install the updates: http://support.microsoft.com/kb/883825

    For more information, see the following Microsoft article.

    http://Windows.Microsoft.com/en-us/Windows-Vista/Windows-Update-Error-80070020

    Hope the information is useful.

  • SOS HELP power problem

    My tochpad is not turn off when I press and hold the off button. Pls help. Its 2 days ago

    Press and hold the power switch and the home button for at least 15 seconds to force a restart.

    WyreNut

  • Need help how to group information using bi publisher of learning.

    I'm new to bi publisher and I'm lost.  I want to have a group and display the program once type at the top of this group.
    So, I want to display each role information that correspond to this group located below.

    My program_type group of the top poster and curls.
    The rest of the prints some information, but not with the appropriate group.    I have my sql, I got my information and sorted but I do not group the information into my sql.

    I don't know if that should happen in my sql before I exported the information in xml format.

    I'd appreciate any help or tutorial that will lead me in the right direction.

    MY MARKUP

    <? for-each-group: ROWSET1_ROW; / PROGRAM_TYPE? > <? type: PROGRAM_TYPE? > <? PROGRAM_TYPE? >
    <? for-each: ROWSET1_ROW? > <? PROGRAM_CODE? >
    <? Program name? >
    <? PROGRAM_DESCRIPTION? >
    <? FINANCIAL_PROG_NAME? > <? end foreach? >
    <? the end for the Group? >

    How IT DISPLAYS


    Theatre
    TV
    Activity |  ACTD |
    code |             |
    03. SHOW | Good Times |  TEST1
    03. SHOW | Jeffersons |   TEST1
    04. MOVIE | Transformers |   TEST1
    04. MOVIE | SpiderMan |   TEST1
    04. MOVIE | The planet of the apes | TEST1

    MY XML


    <? XML version = "1.0" encoding = "UTF-8"? >
    < DATA >
    < ROWSET1 >
    < ROWSET1_ROW >
    < PROGRAM_CODE > 03 < / PROGRAM_CODE >
    See THE < PROGRAM_DESCRIPTION > < / PROGRAM_DESCRIPTION >
    the good times < program name > < / program name >
    TV < PROGRAM_TYPE > < / PROGRAM_TYPE >
    Test1 < FINANCIAL_PROG_NAME > < / FINANCIAL_PROG_NAME >
    < EFFECTIVE_START_DATE > 10/01/2000 < / EFFECTIVE_START_DATE >
    < EFFECTIVE_END_DATE > < / EFFECTIVE_END_DATE >
    < / ROWSET1_ROW >
    < ROWSET1_ROW >
    < PROGRAM_CODE > 03 < / PROGRAM_CODE >
    See THE < PROGRAM_DESCRIPTION > < / PROGRAM_DESCRIPTION >
    < Program name > Jeffesons < / program name >
    TV < PROGRAM_TYPE > < / PROGRAM_TYPE >
    Test1 < FINANCIAL_PROG_NAME > < / FINANCIAL_PROG_NAME >
    < EFFECTIVE_START_DATE > 10/01/2000 < / EFFECTIVE_START_DATE >
    < EFFECTIVE_END_DATE > < / EFFECTIVE_END_DATE >
    < / ROWSET1_ROW >
    < ROWSET1_ROW >
    < PROGRAM_CODE > 04 < / PROGRAM_CODE >
    FILM of < PROGRAM_DESCRIPTION > < / PROGRAM_DESCRIPTION >
    Processors of < program name > < / program name >
    Theatre of < PROGRAM_TYPE > < / PROGRAM_TYPE >
    Test1 < FINANCIAL_PROG_NAME > < / FINANCIAL_PROG_NAME >
    < EFFECTIVE_START_DATE > 10/01/2000 < / EFFECTIVE_START_DATE >
    < EFFECTIVE_END_DATE > < / EFFECTIVE_END_DATE >
    < / ROWSET1_ROW >
    < ROWSET1_ROW >
    < PROGRAM_CODE > 04 < / PROGRAM_CODE >
    FILM of < PROGRAM_DESCRIPTION > < / PROGRAM_DESCRIPTION >
    SpiderMan < program name > < / program name >
    Theatre of < PROGRAM_TYPE > < / PROGRAM_TYPE >
    Test1 < FINANCIAL_PROG_NAME > < / FINANCIAL_PROG_NAME >
    < EFFECTIVE_START_DATE > 10/01/2000 < / EFFECTIVE_START_DATE >
    < EFFECTIVE_END_DATE > < / EFFECTIVE_END_DATE >
    < / ROWSET1_ROW >
    < ROWSET1_ROW >
    < PROGRAM_CODE > 04 < / PROGRAM_CODE >
    FILM of < PROGRAM_DESCRIPTION > < / PROGRAM_DESCRIPTION >
    planet of the apes < program name > < / program name >
    Theatre of < PROGRAM_TYPE > < / PROGRAM_TYPE >
    Test1 < FINANCIAL_PROG_NAME > < / FINANCIAL_PROG_NAME >
    < EFFECTIVE_START_DATE > 10/01/2000 < / EFFECTIVE_START_DATE >
    < EFFECTIVE_END_DATE > < / EFFECTIVE_END_DATE >
    < / ROWSET1_ROW >
    < / ROWSET1 >
    < / DATA >

    Howard

    Found the answer in the next post

    How you group themes

    answer:

    Yes, you can achieve this by using the data model. Read the 5.6.2 XML Editor User Guide (Chapter 9) for more details.

    Link to the document

    http://www.Oracle.com/technetwork/middleware/bi-Publisher/documentation/xmlpenterprise562userguide-130839.PDF

    sample






    Thank you

  • 1000 - 1305TU: pls help power on password

    Dear all,

    Please help me, I forgot my password of my Hp1000-1305TU market

    Error code is 58825920

    Pls help me to remove.

    Try to enter

    47783306

  • It not install Power Shell 2.0 KB968930

    This update of windows fails during the installation or my computer crashes.  I tried to go to the previous restore points but I did it so many times, I can't find an earlier date to use it anymore.

    I use Windows Home Vista Premium 64 bit.

    Question 1: I tried to hide the ms services and disabling startups.  Is there another way I could install this update?

    Question 2: How can I find the previous restore points by say using a calendar?  I like the old version of window xp.

    Thanks for any help.

    Question 1: I tried to hide the ms services and disabling startups.  Is there another way I could install this update?

    Please ask this question in the Windows Update forum:
    http://answers.Microsoft.com/en-us/Windows/Forum/windows_vista-windows_update?page=1&tab=no

    Question 2: How can I find the previous restore points by say using a calendar?  I like the old version of window xp.

    Not by the calendar.
    Under Vista, when you perform a system restore, we will ask you to use the recommended restore point, or you can choose a different restore point.
    When you choose to take a different restore point, you will receive a list of dates (restore points) which is wherer, you choose the restore point.
    You can also click the box at the bottom that says "Restore show more than 5 days Points" in order to see more on the list of restore points, if you have more than 5 days of restore points.
    Those on the list are the restore points that you can purchase.

    See screenshot:

Maybe you are looking for

  • Questions about a "global license agreement.

    A customer said they have a "global license agreement" with Microsoft and we asked to quote the following: ExchgSvrStd 2013 MVL Standard WINDOWS ExchgSvrEnt 2013 MVL Standard WINDOWS ExchgStdCAL 2013 WOMEN MVL UsrCAL Standard WinSvrStd 2012 WINDOWS M

  • Suite McAfee Security

    I felt it necessary to perform a complete system recovery. In doing so, I lost my Iolo System Shield 3. The McAfee trial version will not uninstall and won't let me reinstall the Suite Iolo.

  • Problem with Windows Media Player?

    I tore pieces of music on the memory sticks USB, but suddenly the tracks will not be playing through WMP on my PC. Is the problem with WMP or my USB? How can I solve the problem? Tracks still on ok read WMP.

  • To delete or not to delete x 86 programs to a x 64 machine running Windows 7?

    To the right,. I have a laptop with little disk space. I want to delete files not needed to reclaim the disk space. Is it not possible to remove Microsoft C++ x 86 files and libraries in the form of good x 86 fichiers.net and without affecting operat

  • Home-4215-3725 no link

    Good day everyone! I read all the guides from cisco, but I can't understand why I encounter the following problem: 1. I have'got 4215 in inline mode 2 Windows host with 10.0.3.1/24,10.0.3.254 (ip\mask, gateway) is on the fa0/1 interface and Cisco 372