Unable to exit Deploy-Application.ps1 and force exit code 3010

I am using the PSADT to perform a simple folder name change. I need to force the system to restart after. I’ve seen numerous bits and pieces on this but no real solution. There is an assumption of knowledge that I haven’t reached yet. Can someone tell me what line to put in the script that will hand SCCM a 3010 exit code and where to place that line or lines.

Can someone provide detailed instructions on how to force exit code 3010 to CM when the script is finished?

Exit 3010

I think that’s all you should have to put in the script to send a 3010 exit code.

That will work but it won’t be logged. Some of the fancy features like BlockExecution will stick around, too.
You’ll want logging because when things go South, you won’t be there to see it.
The proper way is:

Exit-Script -ExitCode 3010

This is in the PDF manual.

You have a link to the PDF manual?

Also, where does that go in the script? What line? And does it go in the Deploy-Application.ps1 script?

It’s almost like this is a secret I have to spend hours and hours figuring out when I’m in the middle of a 20,000 system update.

You should already have it when you Downloaded the ZIP file.

In case you didn’t, go to https://psappdeploytoolkit.com/
Click Download on the left
Then click on this:

The PDF is in the root folder of the Zip file.

And yes, Exit-Script -ExitCode 3010 does go in the Deploy-Application.ps1 script.