Hello together.
I have found a very useful PowerCLI Script for reporting virtual servers.
(see attached file) Original by LucD
But i need three more fields inside the report to make it perfect for me.
1. a seperate field with total size of a snapshot
2. a seperate field with total size of a vm (sum of vmdk files, memory, snapshot files and so on)
3. Powerd OFF / Powered ON VM as well as Templates with whole file size
I have no idea how to implement it. Can someone help me.
That would be very nice.
Thanks.
Regards
ron9999
No. Not per harddisk. Only combined information of all harddisks.
Maybe i give you an example.
In the script your wrote we have these fields for one vm.
ProvisionedSpaceGB
190GB (all vmdk and rdm files)
UsedspaceGB
15GB (all vmdk files. rdm files are exluded) we have 175GB rdm
VMProvisionedMB
195GB (the total provisioned size of a vm including rdm)
VMUsedMB
195GB (the total used size of a vm including rdm)
Is it not possible to extract the rdm information from ProvisionedSpaceGB, because the value are exactly the same as for used you wrote and add it to the UsedspaceGB. In this way only the vmdk files will be considered by the usedspaceGB query.
Ok, I think I understood what you want.
In the attached script I split out provisioned space into a property for VMDKs and another for RDMs.
____________
Blog: LucD notes
Twitter: lucd22
Blog: lucd.info Twitter: @LucD22 Co-author PowerCLI Reference
Hi LucD.
Thanks. That is what i wanted.
The methode you used for the VMProvisionedMB (VirtualMachineStorageSummary) is for some servers not exactly. The memory wasn't calculated in the sum of Provisioned Storage. That is not your fault, because the VI Client shows the same values. I think that is a bug of Vmware.
Is this a known bug? If yes it is OK for me because only few servers shows me the incorrect value.
Many thank again for your help
Hi.
I have a little problem with the last script createt from LucD in this discussion. If i run the script several times connected every time to different Virtual Center Server the last output file shows me all information of the last VC and all other VC's combined in one file although the output file has different names.
How can that be possible because i made a connection only to one VC. Is there a cache where all information will be stored? I run the script every time from one server.
Thank you for help
Regards
ron9999
Can you do a
Get-PowerCLIConfiguration
I suspect it will say 'multiple' for the 'Default Server Mode' property.
From the explanation in the Set-PowerCLIConfiguration cmdlet it says "If no target servers are specified, cmdlets run on the servers in the variable."
This means for example that if you a Get-VM in 'multiple' mode, you will get the guests from all vCenters (or ESX(i) servers) you're connected to.
____________
Blog: LucD notes
Twitter: lucd22
Blog: lucd.info Twitter: @LucD22 Co-author PowerCLI Reference
Hi LucD.
i used Get-PowerCLIConfiguration and got "multiple" property. I manually disconnected all connection to all VC and now everything is correct. Now i insert the disconnect-viserver command at the end of the script.
Finally a little question. Is it possible to implement two seperate fields in the script (attached) with Total Size and Free Space of each datastore?
It would be very nice?
Thanks
Sure, try the attached script
____________
Blog: LucD notes
Twitter: lucd22
Blog: lucd.info Twitter: @LucD22 Co-author PowerCLI Reference
I got following error messages.
The input object cannot be bound to any parameters for the command either because the command does not take pipeline input or the input and its properties do not match any of the parameters that take pipeline input.
At :line:51 char:43
+ $row.DSSizeMB = ($_ | Get-Datastore <<<< ).CapacityMB
The input object cannot be bound to any parameters for the command either because the command does not take pipeline input or the input and its properties do not match any of the parameters that take pipeline input.
At :line:52 char:43
+ $row.DSFreeMB = ($_ | Get-Datastore <<<< ).FreeSpaceMB
That comes from the templates.
Try it with this version, it retrieves the capacity and free space in a different way which is valid for VMs and templates.
____________
Blog: LucD notes
Twitter: lucd22
Blog: lucd.info Twitter: @LucD22 Co-author PowerCLI Reference
Now there are no error messages but the templates shows me no TotalDatastore and DatastoreFree information just as server that are distributed over more than one datastore.
For me isn't this a problem because the TotalDatastore and DatastoreFree information are shown on other VM's. Maybe there is a workaround for this issue but it isn't necessary.
Thanks again
Sorry my fault. I opened the wrong output file. Everything is correct.
Thanks
Hi Lucd,
Today is my first day into PowerCLI. We have to create a build sheet for every VM creation individually. Currently we need to create this individual build sheet for around 600 VM’s, We have the list of VM names in the .txt or .csv file. which is running the guest OS windows server (2000, 2003, 2008 & 2008 R2). We have vSphere 4.0 & 5.0 virtual environment . So I need a powerCLI script which can support both the environment & gives the exact details as below in the same format (list view) for every VM which is in the .csv or .txt file as I mention earlier. The output should be in .xls file and We need a single .xls file for every individual servers. Please help me.
VM Host Name | TEST01VM |
Operating System with Edition | Windows 2008 R2 DC |
Thick/Thin Provisioning | Thick |
Network Adaptor Type | VMXNET3 |
Configured VLAN | 633 |
Configure IP | 192.48.20.65 |
Configured Gateway | 192.48.20.1 |
Subnet Mask | 255.255.255.0 |
Configure DNS Primary / Secondary | 192.48.20.20/192.48.20.21 |
Configure DNS Suffix | corp.local |
Vmware tools | Running Current Version |
Hardware version | 8 |
Hot CPU/Memory Option Enabled or Not | Enabled |
Thanks ,
Suresh