Can you give some more details on the environment in which you are trying to run the script ?
vSphere version, PowerCLI version ?
From where and how do you run the script (PowerCLI promp,Gui...) ?
Does the customizationspec you created work when you use it from the vSphere client ?