Puppet – Join machine to the Windows AD Domain


install powershell module

puppet module installpuppetlabs-powershell
Under modules/module name/manifests folder create manifest file,password is encrypted with Hiera,after machine is joined to domain, it will be rebooted.
class domain_membership (
  $domain = 'ad.contoso.com',
  $username = 'administrator',
  $password = lookup('password'),
  $secure_password = false,
  $machine_ou      = 'OU=test,DC=ad,DC=contoso,DC=com',

$code = " 
$secStr=ConvertTo-SecureString '${password}' -AsPlainText -Force; 
if (-not $?) { 
write-error 'Error: Unable to convert password string to a secure string'; 
exit 10; 
$creds=New-Object System.Management.Automation.PSCredential( '${username}', $secStr ); 
if (-not $?) { 
write-error 'Error: Unable to create PSCredential object'; 
exit 20; 
Add-Computer -DomainName ${domain} -OUPath $_machine_ou -Restart -Force -Cred $creds; 
if (-not $?) { 
write-error 'Error: Unable to join domain'; 
exit 30; 
exit 0"

# Use the Josh Cooper PowerShell provider
exec { 'join_domain':

command => $code,
provider => powershell,
logoutput => true,
unless => "if ((Get-WMIObject Win32_ComputerSystem).Domain -ne '${domain}') { exit 1 }",


View original post

Best practices for DNS settings on DC and domain members.


The following information explains the Best practices for DNS client settings on Domain Controller and Domain Member.

Domain controller with DNS installed:
On a domain controller that also acts as a DNS server, recommended that you configure the domain controller’s DNS client settings according to these specifications:

IP configuration on domain controller:

  • In single DC/DNS in a domain environment,  DC / DNS server points to its private IP address (not to loopback 127.x.x.) as preferred DNS server in TCP/IP property.
  • If multiple DCs that’s the DNS servers are in a domain environment, recommendation to have all DCs point to ANOTHER/REMOTE DC’s IP address as preferred DNS and then point to it’s private IP address as an alternate DNS.
  • Each DC has just one IP address and one network adapter is enabled (disable unused NICs).
  • IPv6 should not be disabled on DC’s NIC card. Set it to “obtain IPV6 address automatically” and “obtain…

View original post 186 more words