Sunday, July 3, 2016
Document all VMs and their associated resources
So this one was out of necessity. When I started my new job I quickly realized
that our AV solution was used to lock out workstation directories like AppData
and c:\temp. These security settings meant
I couldn’t run RVTools to document my virtual environment. I have always pulled out data from VMware so
I can monitor growth patterns and now I couldn’t use my process so I had to
find another way. That’s when I came up
with the script below. It’s not all the
information RVTools would provide but it’s enough to understand growth and when
to add hosts to the cluster.
Start of script
Connect-VIServer 'YourServer' -user YourDomain\YourUser
-Password YourPassword
Get-VMHost | Select-Object Name, State, ConnectionState,
PowerState, VMSwapfileDatastoreId, VMSwapfilePolicy, ParentId, IsStandalone,
Manufacturer, Model, NumCpu, CpuTotalMhz, CpuUsageMhz, LicenseKey,
MemoryTotalMB, MemoryTotalGB, MemoryUsageMB, MemoryUsageGB, ProcessorType,
HyperthreadingActive, TimeZone, Version, Build, Parent, VMSwapfileDatastore,
StorageInfo, NetworkInfo, DiagnosticPartition, FirewallDefaultPolicy,
ApiVersion, MaxEVCMode, CustomFields, ExtensionData, Id, Uid, Client,
DatastoreIdList | Sort-Object Name | Export-Csv 'C:\temp\vCenter.csv'
-NoClobber –NoTypeInformation
Disconnect-VIserver * -confirm:$false
End of script
Also if you want to email the exported file you
can use the send-MailMessage command.
That can be found here: http://mytechnicalsolution.blogspot.com/search/label/send-MailMessage
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment