Add a computer in a domain

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

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

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

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

You need to add -Domain as a param.