windows.domainjoin/CLIENT_DATA/join.ins
2014-02-21 12:39:39 +01:00

29 lines
1.0 KiB
TeX
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

[INITIAL]
Message = "Rechner wird zur Domäne hinzugefügt!"
;Message = "Join computer to the domain!"
[Actions]
DefVar $dom$
DefVar $user$
DefVar $password$
set $dom$ = GetProductProperty("domainname", " ")
set $user$ = GetProductProperty("joinadmin", " ")
set $password$ = GetProductProperty("joinadminpw", " ")
PatchTextFile_Create_powershell %scriptpath%\join.ps1
ShellBatch_JoinDom
; mit wahl des ou pfades also abhängig ob ou-pfad leer den aufrunf ändern.
; Add-Computer -domainname DOMAIN -OUPath "OU=OU1,OU=OU2,OU=Domainname,DC=company,DC=com" -cred DOMAIN\AuthorizedUser -passthru verbose
[PatchTextFile_Create_powershell]
AddLine "$secpasswd = ConvertTo-SecureString '$password$' -AsPlainText -Force"
AddLine '$mycreds = New-Object System.Management.Automation.PSCredential ("$user$", $secpasswd)'
AddLine 'Add-Computer -DomainName "$dom$" -credential $mycreds'
SaveToFile "c:\joinpatched.ps1"
[ShellBatch_JoinDom]
set-executionpolicy RemoteSigned
powershell c:\joinpatched.ps1
del c:\joinpatched.ps1