Windows 8 Enterprise - Domain join per Script (PS1 & VBS) does not work

AWS

Owner
FPCH Owner
Joined
Nov 19, 2003
Messages
11,228
Location
Florida U.S.A.
PowerShell Script
Param([bool]$_dbg=$false)
$Credential = New-Object -TypeName System.Management.Automation.PSCredential -ArgumentList @('DOMAIN1username', (ConvertTo-SecureString -AsPlainText -Force 'password01' ))
Add-Computer -DomainName DOMAIN1 -OUPath 'OU=OU1,OU=OU2,DC=DOMAIN,DC=1' -PassThru -Verbose -Credential $credential

Error message
AUSFÜHRLICH: Ausführen des Vorgangs &quotDomäne &quotDOMAIN1&quot beitreten&quot für das Ziel &quotCOMPUTER01&quot.
Add-Computer : Fehler beim Beitreten des Computers &quotCOMPUTER01&quot aus seiner aktuellen Arbeitsgruppe &quotWORKGROUP&quot zur Domäne &quotDOMAIN1&quot. &gt
Error message: Access denied.
In C:pfad_zum_scriptdj.ps1:4 Zeichen:1
+ Add-Computer -DomainName DOMAIN1 -OUPath 'OU=OU1,OU=OU2,DC=DOMAIN...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : OperationStopped: (COMPUTER01:String) [Add-Computer], InvalidOperationException
+ FullyQualifiedErrorId : FailToJoinDomainFromWorkgroup,Microsoft.PowerShell.Commands.AddComputerCommand

HasSucceeded ComputerName
------------ ------------
False COMPUTER01

Comment
The script will be run via batch with this command: call &quotC:WindowsSystem32WindowsPowerShellv1.0powershell.exe&quot C:pfad_zum_scriptdj.ps1
VBScript
Const JOIN_DOMAIN = 1
Const ACCT_CREATE = 2
Const ACCT_DELETE = 4
Const WIN9X_UPGRADE = 16
Const DOMAIN_JOIN_IF_JOINED = 32
Const JOIN_UNSECURE = 64
Const MACHINE_PASSWORD_PASSED = 128
Const DEFERRED_SPN_SET = 256
Const INSTALL_INVOCATION = 262144
strDomain = &quotDOMAIN1&quot
strOU = &quotOU=Kursraum,OU=OU1,OU=OU2,DC=DOMAIN,DC=1&quot
strPassword = &quotpassword01&quot
strUser = &quotusername&quot
Set objNetwork = CreateObject(&quotWScript.Network&quot)
strComputer = objNetwork.ComputerName
Set objComputer = _
GetObject(&quotwinmgmts:{impersonationLevel=Impersonate}!\&quot &amp _
strComputer &amp &quotrootcimv2:Win32_ComputerSystem.Name='&quot _
&amp strComputer &amp &quot'&quot)
ReturnValue = objComputer.JoinDomainOrWorkGroup(strDomain, _
strPassword, _
strDomain &amp &quot&quot &amp strUser, _
strOU, _
JOIN_DOMAIN + ACCT_CREATE)

Error message
Access denied
Comment
The script will be run via batch with this command: start /wait c:WindowsSystem32wscript.exe //I c:pfad_zum_scriptdj.vbs
Main way
If i connect the client [URL="
by hand to the domain, this works without any error.
Server environment
  • 3 Domain controller (Windows Server 2008 R2, ServicePack 1)
Comments
I have tried to leave to OU-Command out of the script, the error msg is the same. User name and password are correct -)



View the full article
 
Back
Top