Add a computer in a domain

This topic contains 4 replies, has 4 voices, and was last updated by  Ben Camareno 3 months, 4 weeks ago.

  • Author
    Posts
  • #75332

    Arnold
    Participant

    Hi everybody

    I want to make a configuration which can add a computer in a Domain.
    I downloaded a xComputerManagement Module and I want to know if somebody has an example of configuration to add a computer in a domain.

    Thank's

  • #75341

    Ivan
    Participant

    Not sure what are you looking for, but, check the SAMPLES on the documentation.

  • #75352

    Michael Greene
    Participant

    Yes, there is an example in the ReadMe for the module:
    https://github.com/PowerShell/xComputerManagement#switch-from-a-workgroup-to-a-domain

  • #75755

    Arnold
    Participant

    Thank's for your help.

    I have some errors and not able to fix them.

    After running this configuration on my pull server to create the Mof:

    $ConfigData = @{
        AllNodes = @(
            @{
                NodeName                    = '*'
                PSDscAllowPlainTextPassword = $True
            }
            @{
                NodeName     = 'QFRSPVMSRVQLF'
                DomainName   = 'mydomain'
            }
        )
    }
    
    Configuration SimpleExampleWithCredentials {
        param(
            [Parameter(Mandatory=$true)]
            [ValidateNotNullOrEmpty()]
            [PSCredential]$DomainCredentials
        )
    
        Import-DscResource -Module xComputerManagement
    
        Node $AllNodes.NodeName {
            xComputer DomainJoin {
                Name       = $Node.NodeName
                DomainName = $Node.DomainName
                Credential = $DomainCredentials
            }
        }
    }
    
    SimpleExampleWithCredentials -ConfigurationData $ConfigData -DomainCredential (Get-Credential)
    

    and run my LCM, i got this error:

    Job {6B9A2D69-7118-11E7-80D0-00155DA5C308} : 
    This event indicates that failure happens when LCM is processing the configuration. Error Id is 0x1. Error Detail is The SendConfigurationApply function did not succeed.. Resource Id is [xComputer]join and Source Info is ::11::9::xComputer. Error Message is PowerShell DSC resource MSFT_xComputer  failed to execute Test-TargetResource functionality with error message: Need to specify credentials with domain .
    

    some can help me please

    Thank's

    • #75760

      Ben Camareno
      Participant

      You need to add -Domain as a param.

You must be logged in to reply to this topic.