You will need to provide a bit more info.
How and from where do you run the script?
Are you connected to a vCenter?
Which PowerCLI version are you using?
A screenshot of the first few lines of a run you did would alreayd help.
Blog: lucd.info Twitter: @LucD22 Co-author PowerCLI Reference