Weiche fOU-Zuweisung ja/nein +join.ps1 aus Script entfernt

This commit is contained in:
Dennis Trinks 2015-04-23 16:31:13 +02:00
parent d75ed35495
commit ca60f398aa
1 changed files with 16 additions and 4 deletions

View File

@ -1,15 +1,21 @@
[INITIAL]
Message = "Rechner wird zur Domäne hinzugefügt!"
Message = "Rechner wird zur Domäne hinzugefügt!"
;Message = "Join computer to the domain!"
[Actions]
DefVar $dom$
DefVar $user$
DefVar $password$
DefVar $orgunit$
set $dom$ = GetProductProperty("domainname", " ")
set $user$ = GetProductProperty("joinadmin", " ")
set $password$ = GetProductProperty("joinadminpw", " ")
PatchTextFile_Create_powershell %scriptpath%\join.ps1
Set $orgunit$ = GetProductProperty ("machineobjectou","values")
if not ($orgunit$ = "")
PatchTextFile_Create_powershell_OU c:\joinpatched.ps1
else
PatchTextFile_Create_powershell c:\joinpatched.ps1
endif
ShellBatch_JoinDom
; mit wahl des ou pfades also abhängig ob ou-pfad leer den aufrunf ändern.
@ -20,7 +26,13 @@ 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"
[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"
[ShellBatch_JoinDom]
powershell set-executionpolicy RemoteSigned
powershell -File c:\joinpatched.ps1