Hello,
I am beginner on powershell / Powercli trying to make a report with the fields mentioned in the title.
([vCenter] [Host] [naa (canonicalname)] [DatastoreName] [NumberOfPaths] [VENDOR] [LUN ID])
The reviewed within this great community the following discussions
https://code.vmware.com/forums/2530/?page=2#586132
https://code.vmware.com/forums/2530/vsphere-powercli#581463
https://communities.vmware.com/message/2635694#2635694
I have not managed to look at more examples to make a report with the desired fields.
I found this code on this website.
http://www.vmwarealert.com/2018/06/powercli-script-to-get-datastore.html
worked well!!! but I would like to omit some fields that I do not need...
I have tried to comment on the lines of the unwanted fields but it stopped working and I think the "}" is not well defined but I'm not sure.
on the web you can see the original code is barely modified since I was testing and learning with it (attach).
If someone can help me or redirect me to a code that reports this information, I would greatly appreciate it
I would also like to convert it into html and the body of an email, but this is another issue
regards!!!
What exactly is not working for you?
Seems to work for me.
Blog: lucd.info Twitter: @LucD22 Co-author PowerCLI Reference
Ok, I see what you mean.
The closing curly brace for the function is missing.
The lines
}
should
}
}
Blog: lucd.info Twitter: @LucD22 Co-author PowerCLI Reference
You seem to have an uncommented brace in the beginning.
Try the attached script
Blog: lucd.info Twitter: @LucD22 Co-author PowerCLI Reference
Hi lucD,
Thank you very much again I run it but it does nothing.
Taking away the complexity of the problem, I would use the fields
1-vCenter
2-host
3-naa (canonicalname) 4-NumberOfPaths 5-DatastoreName
6-Capacity
7-FreeSpace
I have commented the code again removing fields but it indicates errors if I leave} where we have been testing but it still does nothing ..
Attach new version... not run
That is correct, the script creates a CSV file.
Is that there?
Which it then sends as an email attachment.
Blog: lucd.info Twitter: @LucD22 Co-author PowerCLI Reference
Yes but it does not dump the information ..
I have tried two runs and the result is the same.
That is not the script I attached
Blog: lucd.info Twitter: @LucD22 Co-author PowerCLI Reference
The closing curly brace for the function was again incorrect.
Try the attached version
Blog: lucd.info Twitter: @LucD22 Co-author PowerCLI Reference
That version works for me
Blog: lucd.info Twitter: @LucD22 Co-author PowerCLI Reference
LucD,
I'm going to test it tomorrow in another vmware environment since my home lab sometimes does strange things, thanks for your help tomorrow I comment ...
regards
Hi LucD,
you were right if that works. but the csv has lost information.
Reviewing I saw that delete the variable $ Datastorename
so I tried adding it with "$ Datastore Name = Get-Datastore | Sort-Object" but I think it comes in with "$ DatastoreInfo = Get-Datastore"
and I have tried to add vCenter and make it multi vcenter to run it in more than 20 vcenters simultaneously
but I have ended it by breaking completely ha ha ha ... I think it's because of the foreach
attched new version
Try with this version
Blog: lucd.info Twitter: @LucD22 Co-author PowerCLI Reference
I'm not sure why the VMHost is missing for you, for me it works.
Can't really change anything if it works
Blog: lucd.info Twitter: @LucD22 Co-author PowerCLI Reference
LucD,
Ok thanks I am going to test it in a physical environment in the end it seems that my lab is not so reliable ..
I comment on results!
thanks for your time Master!!