- Read the source for the PS1 script. I could be a very terrible script kiddie trying to hax yoo, or worse, I could be incompetent.
- Download the PS1 script and drop it somewhere. Anywhere. I have mine off the C root because I am a terrible person.
- Run the PS1 script in powershell. It will spawn an elevated shell if you did not already run it as such, and UAC will ask you for permission to do that.
You can use the shortcut (.lnk) I provided and update the path to wherever you put the script. You can place this shortcut in your start menu to make it really easy to run.
If you are working with timer jobs, I suggest that beyond this script, you also reset the timer job after every deployment. To do this, go into your SharePoint deployment project, open the project properties, navigate to the SharePoint tab, and then set the post-deployment step to:
net stop sptimerv4
net start sptimerv4
This StackExchange issue was really starting to annoy me so I had to come up with some way of scripting this.
There are still times that my SharePoint environment gets confused and I need to manually retract the solution in Visual Studio prior to running the reset script. At least twice a week I'm happy I have this script around. It gets that crazy when you're developing timer jobs!
You will need at least PowerShell 4 as the self-elevating commands require that. If you comment out that line then you should be good with PowerShell 2.
It has been tested with the following configurations:
Visual Studio 2013 / 2015 / 2017
SharePoint 2010 / 2013 / 2016
Though there are some commented services that if uncommented will probably require SP 2016.
This isn't a silver bullet. You'll still need to earn your paycheck, unfortunately. I wish PowerShell was powerful enough to replace me sometimes.
If you're having issues related to that StackExchange link above, make sure all your Elements.xml files have the right namespace. If you're having other issues, I cannot recommend SharePoint.StackExchange.com enough. Start a new thread, and start a discussion here on my repository with your specific issue so I can see if I can integrate the solution into this script.