Auto-commit: 2025-10-31 08:58:35
This commit is contained in:
15
Domain-Integrate-commandline/Install.cmd
Normal file
15
Domain-Integrate-commandline/Install.cmd
Normal file
@@ -0,0 +1,15 @@
|
||||
Set cmdreg=reg
|
||||
Set cmdpowershell=powershell
|
||||
Set cmdpowercfg=powercfg
|
||||
if defined PROCESSOR_ARCHITEW6432 Set cmdreg=%SystemRoot%\sysnative\reg.exe
|
||||
if defined PROCESSOR_ARCHITEW6432 Set cmdpowershell=%SystemRoot%\sysnative\WindowsPowerShell\v1.0\powershell.exe
|
||||
if defined PROCESSOR_ARCHITEW6432 Set cmdpowercfg=%SystemRoot%\Sysnative\cmd.exe /c powercfg
|
||||
|
||||
%cmdpowershell% -noprofile -command "Set-ExecutionPolicy bypass LocalMachine"
|
||||
|
||||
:: force un dns pour fonctionner sur mon LAB
|
||||
%cmdpowershell% -file "%~dp0SetDNS.ps1"
|
||||
|
||||
"%~dp0netdom.exe" JOIN %computername% /Domain:leblogosd.lan /UserD:david /PasswordD:Motdepasse1
|
||||
|
||||
exit /B 0
|
||||
26
Domain-Integrate-commandline/SetDns.ps1
Normal file
26
Domain-Integrate-commandline/SetDns.ps1
Normal file
@@ -0,0 +1,26 @@
|
||||
# Detect Active Card
|
||||
$CarteUP = ""
|
||||
$Cards = Get-NetAdapter
|
||||
foreach ($Card in $Cards) {
|
||||
if (($Card.Status -eq "Up") -and ($Card.Name -notlike "*VMware*" )) {
|
||||
if (($CarteUP -eq "") -or ($CarteUP -like"*wi")) {
|
||||
$CarteUP = $Card.Name
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
# Detect Index Card
|
||||
$IndexCarte = ""
|
||||
$indexCards = Get-NetIPInterface
|
||||
foreach ($indexCard in $indexCards) {
|
||||
if (($indexCard.InterfaceAlias -eq "$CarteUP") -and ($indexCard.AddressFamily -eq "IPv4")) {
|
||||
$IndexCarte = $IndexCard.ifIndex
|
||||
$DHCPCarte = $IndexCard.DHCP
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
Set-DnsClientServerAddress -InterfaceIndex $IndexCarte -ServerAddresses ("192.168.0.210")
|
||||
|
||||
|
||||
BIN
Domain-Integrate-commandline/en-US/netdom.exe.mui
Normal file
BIN
Domain-Integrate-commandline/en-US/netdom.exe.mui
Normal file
Binary file not shown.
BIN
Domain-Integrate-commandline/fr-FR/netdom.exe.mui
Normal file
BIN
Domain-Integrate-commandline/fr-FR/netdom.exe.mui
Normal file
Binary file not shown.
BIN
Domain-Integrate-commandline/netdom.exe
Normal file
BIN
Domain-Integrate-commandline/netdom.exe
Normal file
Binary file not shown.
11
Domain-Integrate-commandline/readme.md
Normal file
11
Domain-Integrate-commandline/readme.md
Normal file
@@ -0,0 +1,11 @@
|
||||
# Domain Join Helper (Batch)
|
||||
|
||||
Batch script to **configure DNS (optional)**, relax PowerShell execution policy for the session, and **join a Windows machine to an AD domain** using `netdom`.
|
||||
|
||||
## 📂 Files
|
||||
- `JoinDomain.cmd` — main batch script
|
||||
- `SetDNS.ps1` — optional DNS configuration helper (called by the batch)
|
||||
|
||||
## ⚙️ What it does
|
||||
1. Executes `SetDNS.ps1` (optional) to force lab DNS.
|
||||
2. Calls `netdom JOIN` to add the computer to the domain.
|
||||
Reference in New Issue
Block a user