Confirm Domain Join during OSD

I’ve got a small group in my TS that double checks the domain join status, then exit with an error code if the OSD process didn’t join the domain properly.

Basically, I’m using PowerShell to do a couple of lookups and writing the information to variables, which I then use to trigger an exit command.

(Get-CimInstance -ClassName win32_computersystem).PartOfDomain

Non-Domain Joined Machine:

Domain Joined Machine:

So in the Task Sequence I wrote each of those commands to their own variables

Now I have that data in variables, which is great for when you’re in debug mode, or capturing your variables to log files for troubleshooting later. My next step I use the DJ_PartOfDomain as a condition. Make sure you do NOT set “Continue on error” or it defeats the entire purpose of this step.

I then tell it to exit with a specific exit code of my choosing: (you can set it to anything, if you wanted to, you could write a script that parsed the  c:\windows\debug\NetSetup.log to find the error code and exit with that.. but that’s another time.

So now, with these 3 simple steps, I’ve added a fail out of the TS if the device isn’t domain joined, and if it was successfully joined, I’ve confirmed which domain it is joined to and saved that into a variable for when I dump logs.

GARYTOWN.COM

Leave a Comment

This site uses Akismet to reduce spam. Learn how your comment data is processed.