SharePoint Stack Exchange is a question and answer site for SharePoint enthusiasts. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I am writing a PS script to add,deploy solution and deploy the features. The sequence is as follows

  1. Check if solution already exists, if yes then
  2. Disable -SPFeature (Runs for around 10 features)
  3. Uninstall the solution.
  4. Remove the solution.
  5. If solution doesn't exist then
  6. Add Solution.
  7. Deploy Solution.
  8. Activate Features

There is no issue in installing/uninstalling but I am getting 2 error messages during execution of the script when the solution is already deployed and I re run the deploy script

When it tries to de activate the features, after deactivating 2 -3 features it throws an error "The security validation of this page is invalid" click back button in your browser"

The other issue is before activating/deactivating I check if the feature is active or not by Get-SPFeature command. It works for features with scope as "Web" but for features scoped as "Site" and "WebApplication" it doesn't find the feature though the same command returns the feature name on PS command prompt but not from the script. Not sure why is this so.

Please suggest

share|improve this question
up vote 1 down vote accepted

Could you please post scripts?

Possibly a caching issue, please read my earlier answer here and see if it helps.

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.