Posted February 12, 201311 yr FPCH Admin 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 "Domäne "DOMAIN1" beitreten" für das Ziel "COMPUTER01". Add-Computer : Fehler beim Beitreten des Computers "COMPUTER01" aus seiner aktuellen Arbeitsgruppe "WORKGROUP" zur Domäne "DOMAIN1". > 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 "C:WindowsSystem32WindowsPowerShellv1.0powershell.exe" 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 = "DOMAIN1" strOU = "OU=Kursraum,OU=OU1,OU=OU2,DC=DOMAIN,DC=1" strPassword = "password01" strUser = "username" Set objNetwork = CreateObject("WScript.Network") strComputer = objNetwork.ComputerName Set objComputer = _ GetObject("winmgmts:{impersonationLevel=Impersonate}!\" & _ strComputer & "rootcimv2:Win32_ComputerSystem.Name='" _ & strComputer & "'") ReturnValue = objComputer.JoinDomainOrWorkGroup(strDomain, _ strPassword, _ strDomain & "" & 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 [*]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 Off Topic Forum - Unlike the Rest
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.