This shows you the differences between two versions of the page.
Both sides previous revisionPrevious revisionNext revision | Previous revisionLast revisionBoth sides next revision | ||
vmware:scripts:getinfo [2018/02/02 17:55] – lunetikk | vmware:scripts:getinfo [2018/04/23 17:53] – lunetikk | ||
---|---|---|---|
Line 6: | Line 6: | ||
#Remove user and pass for pass-through auth | #Remove user and pass for pass-through auth | ||
Connect-VIServer -Server < | Connect-VIServer -Server < | ||
+ | # | ||
+ | |||
$allvminfo = @() | $allvminfo = @() | ||
$vms = Get-Vm | $vms = Get-Vm | ||
+ | $targetfile = " | ||
foreach($vm in $vms){ | foreach($vm in $vms){ | ||
$vminfo = "" | $vminfo = "" | ||
- | $VMHost = Get-VM $vm.Name | select Host | + | $VMHost = Get-VMHost |
$VMHost = $VMHost.Host | $VMHost = $VMHost.Host | ||
$VMNetwork = Get-VM $vm.Name | Select {@($_.guest.IPAddress[0])} | $VMNetwork = Get-VM $vm.Name | Select {@($_.guest.IPAddress[0])} | ||
Line 49: | Line 52: | ||
$allvminfo += $vminfo | $allvminfo += $vminfo | ||
} | } | ||
- | $allvminfo | Select Name, Host, Network, PowerState, CPUCount, RAMAssigned, | + | $allvminfo | Select Name, Host, Network, PowerState, CPUCount, RAMAssigned, |
+ | |||
+ | #The following lines will clean up the .csv | ||
+ | (Get-Content $targetfile).replace(' | ||
+ | (Get-Content $targetfile).replace(' | ||
+ | (Get-Content $targetfile).replace(' | ||
+ | (Get-Content $targetfile).replace(' | ||
</ | </ |