User Tools

Site Tools


userspace:windows7

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revision Previous revision
Next revision
Previous revision
userspace:windows7 [2011/11/21 13:51]
Thomas_H
userspace:windows7 [2021/08/23 08:37] (current)
Line 1: Line 1:
-====== Domainjoin Windows 7 (32Bit) ======+====== Domainjoin Windows 7 ======
  
-==== Domainjoin with a script ====+\\ 
 +Tip:
  
-Dieses Script fügt einen Client zu einer Domäne hinzu. Genutzt wird dazu das Powershell Tool Add-Computer\\ +http://download.uib.de/opsi4.0/products/contribute/full-package/windomain_1.0-2.opsi 
-This Script adds a client to a domain. Realized by the powershell-tool 'add-computer'+Method : wmic 
 + 
 +===== Domainjoin via add-computer command (Opsi Package) ===== 
 + 
 +This Script adds a client to a domain using powershell-tool 'add-computer'
 +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 by tobias
  
-== Properties ==+=== Properties ==
 +Create a OPSI Package with the following product properties:
   * dom - Domäne /domain   * dom - Domäne /domain
   * user - Benutzer zum hinzufügen in die Domäne / User with add-domain-rights   * user - Benutzer zum hinzufügen in die Domäne / User with add-domain-rights
Line 16: Line 25:
 <code winst> <code winst>
 [INITIAL] [INITIAL]
-Message = "Rechner wird zur Domäne hinzugefügt!"+;Message = "Rechner wird zur Domäne hinzugefügt!" 
 +Message = "Join computer to the domain!"
  
 [Actions] [Actions]
Line 41: Line 51:
 </code> </code>
  
----- +\\ 
-==== Domainjoin with a Samba PDC ====+\\ 
 + 
 +===== 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("C:\Windows\cmd64.exe"  
 + 
 +                Registry_install /64Bit  
 +                DosBatch_1 
 +        else 
 +                Registry_install /32Bit 
 +                DosBatch_1 
 +endif 
 + 
 +[Registry_install] 
 +openkey [HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Winlogon] 
 +set "AutoAdminLogon" = "1" 
 +set "DefaultUsername" = "Administrator"  
 +set "DefaultPassword" = "password" 
 + 
 +[DosBatch_1] 
 +%scriptpath%\join.cmd 
 +</code> 
 + 
 + 
 +Content of **join.cmd** 
 + 
 +<code winst> 
 +copy "\\opsiserver\opsi_workbench\windows7-domainjoin\CLIENT_DATA\auto.reg" "C:\tmp\" 
 +copy "\\opsiserver\opsi_workbench\windows7-domainjoin\CLIENT_DATA\join.vbs" "C:\tmp\" 
 +copy "\\opsiserver\opsi_workbench\windows7-domainjoin\CLIENT_DATA\domainjoin.reg" "C:\Windows\System32\" 
 +C:\Windows\system32\regedit.exe /S "C:\Windows\system32\domainjoin.reg" 
 +shutdown /r /f /t 0 
 +</code> 
 + 
 +Content of **join.vbs** 
 + 
 +<code> 
 +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 = "DOMAINNAME"       ' Windowsdomain 
 +strPassword = "DOMAINADMIN"    ' Password 
 +strUser = "ADMINPASSWORD"      ' Domainadmin 
 + 
 +Set objNetwork = CreateObject("WScript.Network"
 +strComputer = objNetwork.ComputerName 
 + 
 +Set objComputer = GetObject("winmgmts:{impersonationLevel=Impersonate}!\\" & _ 
 +    strComputer & "\root\cimv2:Win32_ComputerSystem.Name='" & _ 
 +        strComputer & "'"
 + 
 +ReturnValue = objComputer.JoinDomainOrWorkGroup(strDomain,
 +    strPassword, strDomain & "\" & strUser, NULL, _ 
 +        JOIN_DOMAIN + ACCT_CREATE) 
 + 
 +Set WSHShell = WScript.CreateObject("WScript.Shell"
 +WshShell.Run "shutdown.exe -r -t 0" 
 + 
 +Wscript.Quit 
 +</code> 
 + 
 +Content of **domainjoin.reg** 
 + 
 +<code> 
 +Windows Registry Editor Version 5.00 
 + 
 +[HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\services\LanmanWorkstation\Parameters] 
 +"ServiceDll"=hex(2):25,00,53,00,79,00,73,00,74,00,65,00,6d,00,52,00,6f,00,6f,
 +  00,74,00,25,00,5c,00,53,00,79,00,73,00,74,00,65,00,6d,00,33,00,32,00,5c,00,
 +  77,00,6b,00,73,00,73,00,76,00,63,00,2e,00,64,00,6c,00,6c,00,00,00 
 +"ServiceDllUnloadOnStop"=dword:00000001 
 +"EnablePlainTextPassword"=dword:00000000 
 +"EnableSecuritySignature"=dword:00000001 
 +"RequireSecuritySignature"=dword:00000000 
 +"OtherDomains"=hex(7):00,00 
 +"DomainCompatibilityMode"=dword:00000001 
 +"DNSNameResolutionRequired"=dword:00000000 
 + 
 +[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\RunOnce] 
 +@="C:\\tmp\\join.vbs" 
 +</code> 
 + 
 +Content of **auto.reg** 
 + 
 +<code> 
 +Windows Registry Editor Version 5.00 
 + 
 +[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Winlogon] 
 +"AutoAdminLogon"="1" 
 +"DefaultUsername"="Administrator" 
 +"DefaultPassword"="password" 
 +</code> 
 + 
 + 
 +All these files (a total of 5) have to be copied to the **/<PATH OF YOUR SELFMADE PRODUCTS>/windows7-domainjoin/CLIENT_DATA/** directory. 
 + 
 +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 by chewbacca
Line 48: Line 190:
 tested by:  //[[hungerharke@gmx.de|Thomas_H]] 2011/11/21 14:31// tested by:  //[[hungerharke@gmx.de|Thomas_H]] 2011/11/21 14:31//
  
-Edit the /opt/pcbin/install/win7/custom/unattend.xml:+Edit the /opt/pcbin/install/win7/custom/unattend.xml (or /opt/pcbin/install/win7-x64/custom/unattend.xml):
  
 <code> <code>
Line 101: Line 243:
              
 Set WSHShell = WScript.CreateObject("WScript.Shell") Set WSHShell = WScript.CreateObject("WScript.Shell")
-WshShell.Run "shutdown.exe -r -t 0"+WshShell.Run "shutdown.exe -r -f -t 3" 
 + 
 +set shell = WScript.CreateObject("WScript.Shell"
 +windir = shell.ExpandEnvironmentStrings("%windir%"
 + 
 +set filesys = CreateObject ("Scripting.FileSystemObject"
 +set tempFile = filesys.Getfile(windir & "\system32\join.vbs"
 +tempfile.Delete
  
 Wscript.Quit       Wscript.Quit      
Line 141: Line 290:
 Set the rights of all three files to user opsiconfd:pcpatch Set the rights of all three files to user opsiconfd:pcpatch
  
-Please note: At the moment this solution leaves the "join.vbs" in c:\Windows\system32! An automated solution to remove this file when done has to be find. If you have one, please add it here! 
 ---- ----
userspace/windows7.1321883477.txt.gz · Last modified: 2021/08/23 08:37 (external edit)