This shows you the differences between two versions of the page.
Both sides previous revision Previous revision Next revision | Previous revision | ||
userspace:windows7 [2011/11/21 08:02] tobias |
userspace:windows7 [2021/08/23 08:37] (current) |
||
---|---|---|---|
Line 1: | Line 1: | ||
- | == Domainjoin Windows 7 (32Bit) | + | ====== Domainjoin Windows 7 ====== |
- | Dieses Script fügt einen Client zu einer Domäne hinzu. Genutzt wird dazu das Windowseigene Powershell Tool Add-Computer | + | |
- | == Proerties | + | \\ |
- | * dom - Domäne | + | Tip: |
- | * user - Benutzer zum hinzufügen in die Domäne | + | |
- | * password - Passwort des Domänenbenutzers | + | http:// |
+ | Method : wmic | ||
+ | |||
+ | ===== Domainjoin via add-computer command (Opsi Package) ===== | ||
+ | |||
+ | This Script adds a client to a domain using powershell-tool ' | ||
+ | Dieses Script fügt einen Client zu einer Domäne hinzu. Genutzt wird dazu das Powershell Tool Add-Computer. | ||
+ | |||
+ | You are able to choose the Domain via Product Property | ||
+ | |||
+ | by tobias | ||
+ | |||
+ | === Properties === | ||
+ | Create a OPSI Package with the following product properties: | ||
+ | * dom - Domäne | ||
+ | * user - Benutzer zum hinzufügen in die Domäne | ||
+ | * password - Passwort des Domänenbenutzers | ||
=== join.ins === | === join.ins === | ||
- | < | + | < |
[INITIAL] | [INITIAL] | ||
- | Message = " | + | ;Message = " |
+ | Message = "Join computer to the domain!" | ||
[Actions] | [Actions] | ||
Line 30: | Line 46: | ||
[ShellBatch_JoinDom] | [ShellBatch_JoinDom] | ||
+ | set-executionpolicy RemoteSigned | ||
powershell c: | powershell c: | ||
del c: | del c: | ||
+ | </ | ||
+ | |||
+ | \\ | ||
+ | \\ | ||
+ | |||
+ | ===== Domainjoin with an opsi-package ===== | ||
+ | |||
+ | This Script will show you how to make a Domainjoin in Windows7 with a selfmade opsi-product. | ||
+ | I choose this way because not every auto-installed Client must be a member of the Domain and you are more flexible by installing the Clients. | ||
+ | |||
+ | Script by Mike1987 | ||
+ | |||
+ | * **Tested with opsi 4.0.1** | ||
+ | * **Tested with opsi-winst 4.11.1.6** | ||
+ | * **Tested with win7-x64 4.0.1-5 (Windows7-x64 Professional)** | ||
+ | |||
+ | **THIS PRODUCT IS ABLE TO BE USED IN WINDOWS 7 32-Bit AND 64-Bit ARCHITECTURES!!!** | ||
+ | |||
+ | First of all you have to create a new opsi localboot product (description in Details in the opsi-manual) | ||
+ | In this example the name of the opsi-prodcut is windows7-domainjoin | ||
+ | |||
+ | Content of **setup.ins** | ||
+ | |||
+ | <code winst> | ||
+ | [Initial] | ||
+ | Message= Windows7-Domainjoin | ||
+ | SetLogLevel=6 | ||
+ | ExitOnError=false | ||
+ | ScriptErrorMessages=true | ||
+ | TraceMode=off | ||
+ | |||
+ | if FileExists64(" | ||
+ | |||
+ | Registry_install / | ||
+ | DosBatch_1 | ||
+ | else | ||
+ | Registry_install /32Bit | ||
+ | DosBatch_1 | ||
+ | endif | ||
+ | |||
+ | [Registry_install] | ||
+ | openkey [HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Winlogon] | ||
+ | set " | ||
+ | set " | ||
+ | set " | ||
+ | |||
+ | [DosBatch_1] | ||
+ | %scriptpath%\join.cmd | ||
+ | </ | ||
+ | |||
+ | |||
+ | Content of **join.cmd** | ||
+ | |||
+ | <code winst> | ||
+ | copy " | ||
+ | copy " | ||
+ | copy " | ||
+ | C: | ||
+ | shutdown /r /f /t 0 | ||
+ | </ | ||
+ | |||
+ | Content of **join.vbs** | ||
+ | |||
+ | < | ||
+ | Const JOIN_DOMAIN = 1 | ||
+ | Const ACCT_CREATE = 2 | ||
+ | Const ACCT_DELETE = 4 | ||
+ | Const WIN9X_UPGRADE = 16 | ||
+ | Const DOMAIN_JOIN_IF_JOINED = 32 | ||
+ | Const JOIN_UNSECURE = 64 | ||
+ | Const MACHINE_PASSWORD_PASSED = 128 | ||
+ | Const DEFERRED_SPN_SET = 256 | ||
+ | Const INSTALL_INVOCATION = 262144 | ||
+ | |||
+ | strDomain = " | ||
+ | strPassword = " | ||
+ | strUser = " | ||
+ | |||
+ | Set objNetwork = CreateObject(" | ||
+ | strComputer = objNetwork.ComputerName | ||
+ | |||
+ | Set objComputer = GetObject(" | ||
+ | strComputer & " | ||
+ | strComputer & "'" | ||
+ | |||
+ | ReturnValue = objComputer.JoinDomainOrWorkGroup(strDomain, | ||
+ | strPassword, | ||
+ | JOIN_DOMAIN + ACCT_CREATE) | ||
+ | |||
+ | Set WSHShell = WScript.CreateObject(" | ||
+ | WshShell.Run " | ||
+ | |||
+ | Wscript.Quit | ||
+ | </ | ||
+ | |||
+ | Content of **domainjoin.reg** | ||
+ | |||
+ | < | ||
+ | Windows Registry Editor Version 5.00 | ||
+ | |||
+ | [HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\services\LanmanWorkstation\Parameters] | ||
+ | " | ||
+ | 00, | ||
+ | 77, | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | |||
+ | [HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\RunOnce] | ||
+ | @=" | ||
+ | </ | ||
+ | |||
+ | Content of **auto.reg** | ||
+ | |||
+ | < | ||
+ | Windows Registry Editor Version 5.00 | ||
+ | |||
+ | [HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Winlogon] | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | </ | ||
+ | |||
+ | |||
+ | All these files (a total of 5) have to be copied to the **/<PATH OF YOUR SELFMADE PRODUCTS>/ | ||
+ | |||
+ | The build the product with **opsi-makeproducfile** an install it with **opsi-package-manager -i windows7-domainjoin_1.0-1.opsi** | ||
+ | |||
+ | \\ | ||
+ | \\ | ||
+ | |||
+ | ===== Domainjoin with a Samba PDC ===== | ||
+ | |||
+ | by chewbacca | ||
+ | |||
+ | tested by: // | ||
+ | |||
+ | Edit the / | ||
+ | |||
+ | < | ||
+ | < | ||
+ | < | ||
+ | < | ||
+ | < | ||
+ | < | ||
+ | < | ||
+ | </ | ||
+ | < | ||
+ | < | ||
+ | < | ||
+ | </ | ||
+ | </ | ||
+ | </ | ||
+ | |||
+ | Domain means: the domain the client should be included\\ | ||
+ | Password means: the password of the domainadmin, | ||
+ | Username means: the name of the domainadmin.\\ | ||
+ | |||
+ | Beginners please note: if the domainadmin' | ||
+ | |||
+ | Create a file named " | ||
+ | |||
+ | === join.vbs === | ||
+ | <code winst> | ||
+ | Const JOIN_DOMAIN = 1 | ||
+ | Const ACCT_CREATE = 2 | ||
+ | Const ACCT_DELETE = 4 | ||
+ | Const WIN9X_UPGRADE = 16 | ||
+ | Const DOMAIN_JOIN_IF_JOINED = 32 | ||
+ | Const JOIN_UNSECURE = 64 | ||
+ | Const MACHINE_PASSWORD_PASSED = 128 | ||
+ | Const DEFERRED_SPN_SET = 256 | ||
+ | Const INSTALL_INVOCATION = 262144 | ||
+ | |||
+ | strDomain = " | ||
+ | strPassword = "very secret" | ||
+ | strUser = " | ||
+ | |||
+ | Set objNetwork = CreateObject(" | ||
+ | strComputer = objNetwork.ComputerName | ||
+ | |||
+ | Set objComputer = GetObject(" | ||
+ | strComputer & " | ||
+ | strComputer & "'" | ||
+ | |||
+ | ReturnValue = objComputer.JoinDomainOrWorkGroup(strDomain, | ||
+ | strPassword, | ||
+ | JOIN_DOMAIN + ACCT_CREATE) | ||
+ | | ||
+ | Set WSHShell = WScript.CreateObject(" | ||
+ | WshShell.Run " | ||
+ | |||
+ | set shell = WScript.CreateObject(" | ||
+ | windir = shell.ExpandEnvironmentStrings(" | ||
+ | |||
+ | set filesys = CreateObject (" | ||
+ | set tempFile = filesys.Getfile(windir & " | ||
+ | tempfile.Delete | ||
+ | |||
+ | Wscript.Quit | ||
+ | </ | ||
+ | |||
+ | and copy it to / | ||
+ | |||
+ | Create a file name " | ||
+ | |||
+ | === default.reg === | ||
+ | <code winst> | ||
+ | Windows Registry Editor Version 5.00 | ||
+ | |||
+ | ;Insert Samba Patch | ||
+ | [HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\services\LanmanWorkstation\Parameters] | ||
+ | " | ||
+ | " | ||
+ | |||
+ | ;join Domain at first start | ||
+ | [HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\RunOnce] | ||
+ | " | ||
+ | </ | ||
+ | |||
+ | and copy it to / | ||
+ | |||
+ | Create a file named " | ||
+ | |||
+ | === 21_reg.cmd === | ||
+ | <code winst> | ||
+ | rem --- Win7samba Patch and Join Script | ||
+ | echo [%date% %time%] copy -s " | ||
+ | copy " | ||
+ | echo [%date% %time%] Executing: regedit /s " | ||
+ | regedit /s " | ||
+ | </ | ||
+ | |||
+ | and copy it to / | ||
+ | |||
+ | Set the rights of all three files to user opsiconfd: | ||
- | [/code] | + | ---- |