Thursday, 3 August 2023

ADD DNS ENTRY IN POWERSHELL

ADD DNS ENTRY IN POWERSHELL



Add an A record
Add-DnsServerResourceRecordA -Name "host123" -ZoneName "ABC.COM" -AllowUpdateAny -IPv4Address "172.18.99.24" 

Add an A resource record under the Admin node

Add-DnsServerResourceRecord -ZoneName "ABC.COM" -A -Name "Host21.admin" -IPv4Address "172.18.99.20"


Add a CNAME resource record

Add-DnsServerResourceRecord -CName -Name "labhost34" -HostNameAlias "Host34.lab. ABC.COM" -ZoneName "ABC.COM" -AllowUpdateAny


Add a PTR resource record

Add-DnsServerResourceRecord -Name "24" -Ptr -ZoneName "1.168.192.in-addr.arpa" -AllowUpdateAny -PtrDomainName "host24.ABC.com"




Add an MX resource record

Add-DnsServerResourceRecord -Name "." -MX -ZoneName "ABC.com" -MailExchange "mail.ABC.com" -Preference 10

2 comments:

  1. How to add bulk logonworkstation.

    ReplyDelete
  2. Try This

    $Users = (Get-ADUser -Identity User -Properties LogonWorkstations)
    ForEach($User in $Users)
    {
    $User.LogonWorkstations +=",test1,test2,test3"
    Set-ADUser -Instance $User
    }

    ReplyDelete