PaaS domain join issue

We are attempting to join a PaaS instance to a domain when the instance is spun up.  We have verified our scripts work to actually join the domain, but this does not seem to work unless we first change the name of the VM.  Has anybody seen this behavior before?  We want the PaaS instance to keep the original, random name.  Once we change the name of the VM, the scripts work as expected and it joins the domain and installs the Microsoft Monitoring Agent.

February 6th, 2015 6:10pm

Do you mind sharing the script? I have successfully joined a domain without changing the name of the virtual machine. However, I've also installed a DC on that VM, which might be the difference between our scenarios.

Alex

Free Windows Admin Tool Kit Click here and download it now
February 6th, 2015 7:26pm

Here is a sanitized script...  We do have 4 DNS servers specified in the CSCFG file, 2 Azure DNS servers and 2 Google DNS servers.  Not sure if that is causing an issue, either.

 # Set up domain account credentials to be used by the script
    $clientDomain = "domain"
    $username = "$clientDomain\useraccount"
    $password = "password"
    $secpasswd = ConvertTo-SecureString $password -AsPlainText -Force
    $credential = New-Object System.Management.Automation.PSCredential ($username, $secpasswd)

    if ((gwmi Win32_ComputerSystem).PartOfDomain -eq $false)
    {
        log-msg "Joining domain: $clientDomain"

        # Join this computer to the domain
        Set-DnsClientGlobalSetting -SuffixSearchList $clientDomain
        $result = Add-Computer -Domain $clientDomain -Credential $credential -Restart -Force -PassThru

        if ($result.HasSucceeded -eq $true)
        {
            log-msg "Added computer to APM domain: $clientDomain"
        }
        else
        {
            log-msg "Add-Computer for domain $clientDomain failed"
        }
    }
    else
    {
        log-msg "Installing SCOM Agent..."

        $drive = (Get-Location).Drive.Name
        $location = "$($drive):\MOMAgent.msi"

        # Map a new drive to copy the MSI file to the local computer using the domain account
        New-PSDrive -Name X -PSProvider FileSystem -Root "\\server\C$\SCOM2012R2\agent\AMD64" -Credential $credential
        Copy-Item -Path X:\MOMAgent.msi -Destination $location

        # Run the installer
        $args = "/i $location /l* install.log /qn USE_SETTINGS_FROM_AD=0 USE_MANUALLY_SPECIFIED_SETTINGS=1 MANAGEMENT_GROUP=`"MgmtGroup`" MANAGEMENT_SERVER_DNS=domain MANAGEMENT_SERVER_AD_NAME=servername ACTIONS_USE_COMPUTER_ACCOUNT=1 AcceptEndUserLicenseAgreement=1"
        Start-Process -FilePath msiexec.exe -ArgumentList $args -Wait

        # Remove the install file
        Remove-Item $location

        # Set the 'System Center Management APM' service to start automatically and start it
        Set-Service "System Center Management APM" -startuptype "automatic"
        Start-Service -name "System Center Management APM"

        log-msg "SCOM Agent has been installed."
    }
}
catch
{
    err-msg $($_.Exception.Message)
}


February 6th, 2015 10:03pm

This topic is archived. No further replies will be accepted.

Other recent topics Other recent topics