https://github.com/powershellcrack/offlinedomainjoin
Script to join a device offline during task sequence
https://github.com/powershellcrack/offlinedomainjoin
Last synced: 2 months ago
JSON representation
Script to join a device offline during task sequence
- Host: GitHub
- URL: https://github.com/powershellcrack/offlinedomainjoin
- Owner: PowerShellCrack
- Created: 2021-03-18T19:31:43.000Z (over 4 years ago)
- Default Branch: master
- Last Pushed: 2021-03-18T19:37:43.000Z (over 4 years ago)
- Last Synced: 2025-10-09T08:32:01.424Z (2 months ago)
- Language: PowerShell
- Size: 1.15 MB
- Stars: 2
- Watchers: 1
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.MD
- Changelog: CHANGELOG.MD
Awesome Lists containing this project
README
# Domain Join Script
## Description
This domain join script was design to support offline domain join capability and post SCCM domain join.
## Use cases
- Task Sequence for both MDT/SCCM
- Offline Domain Join (ODJ)
- Pre Windows Join in PE (Unattend)
- Post WinPE Join (Windows)
### Offline Domain Join
This feature allows the script to use a offline domain join blob or File generated by a Domain Controller to join a system to the domain. This feature works in both WinPE during pre setup and Post setup. Presetup will apply the blob content to the Unattend file. The post setup will run the djoin command
### Unattend
This feature is very similar to the way SCCM or MDT applies the domain join; it adds the domain details to the targeted Unattend.xml file. This feature works both Pre Windows setup (during WinPE) adn Windows Post setup, however it will initiate the sysprep command in post
### Windows
This feature allows a device to join the domain using the Add-Computer cmdlet. This is the default feature and only works in Post WinPE...when Windows is running.
## Examples
Join the domain using Task Sequence variables on while running in Windows
```powershell
DomainJoin.ps1
```
Apply domain info to unattend file; typically done during pre windows. if done during Windows the sysprep parameter will be added
```powershell
DomainJoin.ps1 -JoinMethod Unattend -DomainJoinName contoso.com -Join contoso\admin -JoinPassword P@$$w0rd12
```
Join a device to the domain while logged into windows using credentials
```powershell
DomainJoin.ps1 -JoinMethod Windows -DomainJoinName contoso.com -Join contoso\username -JoinPassword P@$$w0rd12 -Restart
```
Join a device to the domain using a ODJ blob file from a network share uniquely identified by model and serial number
```powershell
DomainJoin.ps1 -JoinMethod ODJ -JoinODJBlobFile \\server01\share01\ODJ\%model%_%serialnumber%.odj -Restart
```
Join a device to the domain using a ODJ blob data
```powershell
DomainJoin.ps1 -JoinMethod Unattend -JoinODJBlob 'ARAIAMzMzMxIAwAAAAAAAAAA...'
```
## Variables
These variables are used during a Task Sequence and will preset the value for most parameters.
- __OfflineDomainJoinBlob__ --> this is custom variable; sets the value for _-JoinODJBlobFile_ parameter
- __OfflineDomainJoinFile__ --> this is custom variable; sets the value for _-JoinODJBlob_ parameter
- __OSDComputerName__ --> sets the _ComputerName_ variable; not a parameter
- __\_SMSTSMachineName__ --> sets the _ComputerName_ variable if _OSDComputerName_ is not found; not a parameter
- __OSDJoinDomainName__ --> sets the value for _-JoinDomainName_ parameter
- __OSDJoinAccount__ --> sets the value for _-JoinUsername_ parameter
- __OSDJoinPassword__ --> sets the value for _-JoinPassword_ parameter
- __OSDJoinDomainOUName__ --> sets the value for _-JoinDomainOU_ parameter
- __OSDisk__ --> sets the _OSDisk_ variable; not a parameter
## Exit Codes
- __0__ --> Successfully joined the domain; reboot may be required
- __-1__ --> Not all required parameters where provided
- __-2__ --> Domain Join failed. Check DomainJoin.log or enable debug and check c:\Windows\Logs\JoinDomain.log