PowerCLI

 View Only
  • 1.  Powercli output

    Posted Sep 18, 2025 07:39 AM

    Hi,

    The following Script brings double entries of each vm in the csv file.

    Get-VM | Get-VMGuest | where-object {$_.State -eq 'Running' -and $_.OSFullName -Like '*Windows*'} | Select VmName, ToolsVersion, OSFullName | export-csv D:\Scripts\VM\VMTools\VMwareToolsVersionWindows_oh.csv

    How can i change this?

    thx

    regards andi



    -------------------------------------------


  • 2.  RE: Powercli output

    Posted Sep 19, 2025 08:26 AM

    No reason those commands on their own should pull double entries.  I suggest making sure you're not connected to vCenter twice in the same PowerCLI session.

    Your current connection vCenter session can be viewed in the variable $global:DefaultVIServers

    -------------------------------------------



  • 3.  RE: Powercli output

    Posted Sep 19, 2025 10:29 AM

    Hi,

    Correctly. There has been more than one connection to the vCenter.

    Many thanks

    Andi

    -------------------------------------------



  • 4.  RE: Powercli output

    Posted Sep 19, 2025 09:17 AM

    You may need to look at the output directly without the CSV part to see what really is going on.

    I added one option I use to your code. Select unique ones based on the VMName

    Get-VM | Get-VMGuest | where-object {$_.State -eq 'Running' -and $_.OSFullName -Like '*Windows*'} | Sort-Object -Property VMName -Unique | Select VmName, ToolsVersion, OSFullName | export-csv D:\Scripts\VM\VMTools\VMwareToolsVersionWindows_oh.csv




  • 5.  RE: Powercli output

    Posted Sep 22, 2025 10:41 AM

    Have you looked into RVTools from Dell?  it would give you a very similar output with much less work.  Make sure you download the only one from dell, as there are issues with third-party downloads

    -------------------------------------------



  • 6.  RE: Powercli output

    Posted Sep 22, 2025 10:48 AM

    RVTools is great. Use it all the time. 

    -------------------------------------------



  • 7.  RE: Powercli output

    Posted Sep 22, 2025 10:45 AM

    In the downloaded files, some scripts need to be run to connect to multiple vCenters, but it is possible to do

    -------------------------------------------



  • 8.  RE: Powercli output

    Posted Oct 02, 2025 09:17 PM

    Use this 

    Get-VM | Get-VMGuest | Where-Object { $_.State -eq 'Running' -and $_.OSFullName -like '*Windows*' } | Select-Object VmName, ToolsVersion, OSFullName -Unique | Export-Csv D:\Scripts\VM\VMTools\VMwareToolsVersionWindows_oh.csv -NoTypeInformation

    -------------------------------------------