Hello, I'm in need of a power CLI script that helps to grab the VM UUID information of the given from a input file... I've a list of VMs about 400 which I want to input them in a text file. Script should be able to taken and provide the output in a .csv file
TIA
Sure, try like this
Select Name,
@{N='vCenter';E={([uri]$_.ExtensionData.Client.ServiceUrl).Host}},
@{N='UUID';E={$_.ExtensionData.Config.Uuid}} |
Export-Csv -Path .\outfile.csv -NoTypeInformation -UseCulture
Blog: lucd.info Twitter: @LucD22 Co-author PowerCLI Reference
What do you actually have in the input file?
VM name, UUID...?
And what should go in the output CSV file?
Blog: lucd.info Twitter: @LucD22 Co-author PowerCLI Reference
Like this (where I assume the input file has the VM's name, one per line)?
Select Name,
@{N='UUID';E={$_.ExtensionData.Config.Uuid}} |
Export-Csv -Path .\outfile.csv -NoTypeInformation -UseCulture
Blog: lucd.info Twitter: @LucD22 Co-author PowerCLI Reference
Hello,
in the input file the VM name
and if a VM has more number of disks that are created on multiple datastores, those needs to be updated in the output CSV file against each VM
Disks?
You lost me now.
What exactly should go into the output file?
Can you show a mockup?
Blog: lucd.info Twitter: @LucD22 Co-author PowerCLI Reference
sorry for the confusion. I'm all set with the output. THANKS
however, is it possible to display in the output file from which vCenter the VM belongs to...(against each VM)
Sure, try like this
Select Name,
@{N='vCenter';E={([uri]$_.ExtensionData.Client.ServiceUrl).Host}},
@{N='UUID';E={$_.ExtensionData.Config.Uuid}} |
Export-Csv -Path .\outfile.csv -NoTypeInformation -UseCulture
Blog: lucd.info Twitter: @LucD22 Co-author PowerCLI Reference