Weiche fOU-Zuweisung ja/nein +join.ps1 aus Script entfernt
This commit is contained in:
parent
d75ed35495
commit
ca60f398aa
@ -1,15 +1,21 @@
|
|||||||
[INITIAL]
|
[INITIAL]
|
||||||
Message = "Rechner wird zur Domäne hinzugefügt!"
|
Message = "Rechner wird zur Domäne hinzugefügt!"
|
||||||
;Message = "Join computer to the domain!"
|
;Message = "Join computer to the domain!"
|
||||||
|
|
||||||
[Actions]
|
[Actions]
|
||||||
DefVar $dom$
|
DefVar $dom$
|
||||||
DefVar $user$
|
DefVar $user$
|
||||||
DefVar $password$
|
DefVar $password$
|
||||||
|
DefVar $orgunit$
|
||||||
set $dom$ = GetProductProperty("domainname", " ")
|
set $dom$ = GetProductProperty("domainname", " ")
|
||||||
set $user$ = GetProductProperty("joinadmin", " ")
|
set $user$ = GetProductProperty("joinadmin", " ")
|
||||||
set $password$ = GetProductProperty("joinadminpw", " ")
|
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
|
ShellBatch_JoinDom
|
||||||
|
|
||||||
; mit wahl des ou pfades also abhängig ob ou-pfad leer den aufrunf ändern.
|
; mit wahl des ou pfades also abhängig ob ou-pfad leer den aufrunf ändern.
|
||||||
@ -21,6 +27,12 @@ AddLine '$mycreds = New-Object System.Management.Automation.PSCredential ("$use
|
|||||||
AddLine 'Add-Computer -DomainName "$dom$" -credential $mycreds'
|
AddLine 'Add-Computer -DomainName "$dom$" -credential $mycreds'
|
||||||
SaveToFile "c:\joinpatched.ps1"
|
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]
|
[ShellBatch_JoinDom]
|
||||||
powershell set-executionpolicy RemoteSigned
|
powershell set-executionpolicy RemoteSigned
|
||||||
powershell -File c:\joinpatched.ps1
|
powershell -File c:\joinpatched.ps1
|
||||||
|
Loading…
Reference in New Issue
Block a user