I am writing a PS script to add,deploy solution and deploy the features. The sequence is as follows
- Check if solution already exists, if yes then
- Disable -SPFeature (Runs for around 10 features)
- Uninstall the solution.
- Remove the solution.
- If solution doesn't exist then
- Add Solution.
- Deploy Solution.
- 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.