2014-02-21 11:28:27 +01:00
|
|
|
|
[INITIAL]
|
2015-04-23 16:31:13 +02:00
|
|
|
|
Message = "Rechner wird zur Domäne hinzugefügt!"
|
2014-02-21 11:28:27 +01:00
|
|
|
|
;Message = "Join computer to the domain!"
|
2015-04-23 16:31:13 +02:00
|
|
|
|
|
2014-02-21 11:28:27 +01:00
|
|
|
|
[Actions]
|
|
|
|
|
DefVar $dom$
|
|
|
|
|
DefVar $user$
|
|
|
|
|
DefVar $password$
|
2015-04-23 16:31:13 +02:00
|
|
|
|
DefVar $orgunit$
|
2014-02-21 11:28:27 +01:00
|
|
|
|
set $dom$ = GetProductProperty("domainname", " ")
|
|
|
|
|
set $user$ = GetProductProperty("joinadmin", " ")
|
|
|
|
|
set $password$ = GetProductProperty("joinadminpw", " ")
|
2015-04-23 16:31:13 +02:00
|
|
|
|
Set $orgunit$ = GetProductProperty ("machineobjectou","values")
|
|
|
|
|
if not ($orgunit$ = "")
|
|
|
|
|
PatchTextFile_Create_powershell_OU c:\joinpatched.ps1
|
|
|
|
|
else
|
|
|
|
|
PatchTextFile_Create_powershell c:\joinpatched.ps1
|
|
|
|
|
endif
|
2014-02-21 11:28:27 +01:00
|
|
|
|
ShellBatch_JoinDom
|
2014-02-21 11:45:35 +01:00
|
|
|
|
|
|
|
|
|
; 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
|
|
|
|
|
|
2014-02-21 11:28:27 +01:00
|
|
|
|
[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"
|
2015-04-23 16:31:13 +02:00
|
|
|
|
|
|
|
|
|
[PatchTextFile_Create_powershell_OU]
|
|
|
|
|
AddLine "$secpasswd = ConvertTo-SecureString '$password$' -AsPlainText -Force"
|
|
|
|
|
AddLine '$mycreds = New-Object System.Management.Automation.PSCredential ("$user$", $secpasswd)'
|
|
|
|
|
AddLine 'Add-Computer -DomainName "$dom$" -OUPath "$orgunit$" -credential $mycreds'
|
|
|
|
|
SaveToFile "c:\joinpatched.ps1"
|
|
|
|
|
|
2014-02-21 11:28:27 +01:00
|
|
|
|
[ShellBatch_JoinDom]
|
2014-08-19 17:53:04 +02:00
|
|
|
|
powershell set-executionpolicy RemoteSigned
|
|
|
|
|
powershell -File c:\joinpatched.ps1
|
2014-02-21 11:28:27 +01:00
|
|
|
|
del c:\joinpatched.ps1
|