Weiche fOU-Zuweisung ja/nein +join.ps1 aus Script entfernt
This commit is contained in:
parent
d75ed35495
commit
ca60f398aa
@ -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.
|
||||
@ -21,6 +27,12 @@ AddLine '$mycreds = New-Object System.Management.Automation.PSCredential ("$use
|
||||
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
|
||||
|
Loading…
Reference in New Issue
Block a user