(imported topic written by SystemAdmin)
I’m putting together a analysis that will hold all of the VMWare data, because we have thousands of guests at many many
sites it gets confusing which VC hosts each guest, using the powershell CLI tools I can query each VC and determine which
host each guest is sitting on. My plan then is to output a csv file with this information and then push that file out to each
guest thats on vmware, then I can have the guest pull it own information from CSV file and report it back to bigfix
here is the information im getting for each guest
“Name”,“PowerState”,“Version”,“Notes”,“Guest”,“NumCpu”,“MemoryMB”,“VMHost”,“VMResourceConfiguration”,“Uid”
the question I have is whats the best way to split this data up, the fields will always remain the same… here is an example
"serverp001",
"PoweredOn",
"v4",
"",
"serverp001:Suse Linux Enterprise Server (32-bit)",
"1",
"512",
"esxhostp002.pek0.domain.com",
"CpuShares:Normal/1000 MemShares:Normal/5120",
"/VIServer=a.domain.wwe00a@serverlp002.pek0.domain.com:443/VirtualMachine=VirtualMachine-vm-1110/"
"serverp002",
"PoweredOn",
"v4",
"",
"serverp002:Microsoft Windows Server 2003, Standard Edition (32-bit)",
"1",
"512",
"esxhostp004.pek0.domain.com",
"CpuShares:Normal/1000 MemShares:Normal/5120",
"/VIServer=a.domain.wwe00a@server002.pek0.domain.com:443/VirtualMachine=VirtualMachine-vm-113/"
all i want to do is pull the pull field 2 “PoweredOn” from the line where it equals my server name “serverp001”
then field 3 and 4 and 5 and so on
Q: item 1 of it of (line whose(it as uppercase contains “serverp001”) of file “C:\Utils\powercli_scripts\all_guests.csv”)
E: The tuple index 1 is out of range.
Q: (line whose(it as lowercase contains “serverp001”) of file “C:\Utils\powercli_scripts\all_guests.csv”)
A: serverp001,PoweredOn,v4,serverp001:Suse Linux Enterprise Server (32-bit),1,512,esxhostp002.pek0.domain.com,CpuShares:Normal/1000 MemShares:Normal/5120,/VIServer=a.domain.wwe00a@serverlp002.pek0.domain.com:443/VirtualMachine=VirtualMachine-vm-1110/
Q: item 1 of (substrings separated by “,” of(line whose(it as lowercase contains “serverp001”) of file “C:\Utils\powercli_scripts\all_guests.csv”))
E: The tuple index 1 is out of range.