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

1 Answer 1


Could you please post scripts?

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

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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