Re-run Task Sequence Tool 1.0
When you’re working with ConfigMgr 2012 and task sequences, these tend to fail now and then. I’ve previously blogged about how you can re-run a required task sequence that is deployed to a client where it has for some reason failed. That blog post can be found here. Instead of logging on to each client and perform the steps in the old blog post, I chose to create a tool that can perform that for me. Of course, you could use PowerShell remoting, but there might be cases when it’s easier for one to use a tool like this. With this tool it’s possible to re-run a required (or available if you choose) task sequence locally on the client or on a remote client.
Download the tool
The tool is available on the TechNet Gallery. You’ll find the link here.
Let’s say that we’ve deployed a task sequence that we configured as required. For some reason it failed on a particular client. We’ve now fixed the issue on the client and would like to execute the task sequence again. If you’d to open up Software Center on that client, you’ll see that the option to Install the task sequence again is not possible.
You could of course create a new deployment of the task sequence, but that might not be what you want for several reasons. Instead we can go ahead and remove the WMI object that tells the ConfigMgr client that this task sequence has already been executed. Depending on the re-run behavior on the deployment, it might solve it self in time, but if you need to remediate the situation quickly, this tool is quite helpful with just that.
The user that executes the tool, needs to be an administrator on the client. If the tool is used on a server to remotely re-run a task sequence on a client, the user executing the tool needs to be an administrator on that client. Always elevate a PowerShell console when running the tool, or it will not work. Regular users with no administrative privileges will not be able to successfully use the tool completely.
Another requirement is if you’re using the remote functionality of the tool, to have WMI connections allowed inbound on the target client. If this is not allowed through any firewall, the tool will not work on remote clients. It could then be copied to the client instead, and executed locally.
Using the tool
Before we go ahead and uses the tool, we first need to look up what the Package ID for the task sequence that is deployed and that we want to re-run. This can easily be done by opening the ConfigMgr console, go to Software Library – Operating Systems – Task Sequences. In the area where all your task sequences are shown to you, look for the Package ID column next to the task sequence in question.
In my scenario, the task sequence called Validate TS Script is the one that failed on my client. As you can see in the Package ID column, the Package ID for this task sequence is PS100015. Take a note of the Package ID. Assuming that you have downloaded the script from the link above and saved it to C:\Scripts on let’s your Primary Site server, we’ll now go ahead and launch it.
1. Open an elevated PowerShell console and browse C:\Scripts.
2. Run the following command:
3. In the PackageID text box, enter the Package ID that we took a note of earlier. In my case it will be PS100015.
4. Choose whether to search locally or remote. In this case I’m gonna select remote and enter the name of my client (which is CL01).
5. Click on Search.
6. As you can see, the tool has found 1 result. In order to delete this, we should now click on the row where it says PS120005-PS100015-6F6BCC28. This string of characters will of course be something else in your environment. When you click on it, notice that in the log view, it will tell you what object has been selected.
7. Now that we’ve selected the object that we want to remove, the Delete button is enabled and we can go ahead and click on it.
8. Once the object has been removed, the Restart Agent button appears. It’s necessary to restart the SMS Agent service (CcmExec) in order to start the task sequence again.
9. Once the SMS Agent service has been restarted, the task sequence should start shortly on the client.
Now that’s it! The task sequence has successfully been re-run on a client.