Quantcast
Viewing all articles
Browse latest Browse all 175326

Get Guestos trough Powercli

Hi all,

 

I wrote below script to get all Vm's in my Vcenters that don't have vmware tools installed. i am trying to include the vm's / guests operating system into the csv output as well and can't seem to figure out how to do this. So if someone could help me out that would be great!

 

New-VIProperty -Name ToolsVersionStatus -ObjectType VirtualMachine ` -ValueFromExtensionProperty 'Guest.ToolsVersionStatus' ` -Force
New-VIProperty -Name ToolsVersion -ObjectType VirtualMachine ` -ValueFromExtensionProperty 'Config.tools.ToolsVersion' ` -Force
$vcenter=Read-Host "Please enter VCenter to run this report on"
$csvlocation=Read-Host "Please enter a location for the CSV logfile"
Connect-ViServer $vcenter
$notools = Get-VM | where-Object {$_.ToolsVersionStatus -eq "guestToolsNotInstalled"}
if ( $notools -eq $null) {
exit
}
else {
Get-VM $notools | Select Name, Version, ToolsVersion, ToolsVersionStatus, powerstate, vmhost, | Export-Csv -NoTypeInformation -UseCulture $csvlocation\$vcenter.csv
}
Disconnect-VIServer $vcenter -Confirm:$False

 

Thanks in advanceImage may be NSFW.
Clik here to view.


Viewing all articles
Browse latest Browse all 175326

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>