Автор Тема: [Powershell] Логика работы Get-DnsServerResourceRecord  (Прочитано 3786 раз)

0 Пользователей и 1 Гость просматривают эту тему.

Оффлайн Retif

  • Администраторы
  • Олдфаг
  • *****
  • Сообщений: 9059
  • Рейтинг: 88
  • Пол: Мужской
  • Афтар
    • Просмотр профиля
    • Мой блог
  • Откуда: Орёл
Выполняю команду
Get-DnsServerResourceRecord -ComputerName dc.domain.local -ZoneName domain.local -Name test01
с заведомо несуществующей записью test01. Закономерно получаю ошибку:

Цитировать
Get-DnsServerResourceRecord : Failed to get test01 record in domain.local zone on dc.domain.local server.
At line:1 char:1
+ Get-DnsServerResourceRecord -ComputerName dc.domain.local -ZoneName do...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : ObjectNotFound: (test01:root/Microsoft/...rResourceRecord) [Get-DnsServerResourceRecord], CimException
    + FullyQualifiedErrorId : WIN32 9714,Get-DnsServerResourceRecord

Пока все нормально.
Создаю A-запись test01 с каким-нибудь адресом. Затем её удаляю. Снова выполняю команду
Get-DnsServerResourceRecord -ComputerName dc.domain.local -ZoneName domain.local -Name test01
На этот раз ошибки нет. На выходе просто пустота. Вопрос, что происходит, собственно?  ???

Оффлайн shs

  • Модератор
  • Ветеран
  • *****
  • Сообщений: 4401
  • Рейтинг: 89
    • Просмотр профиля
    • ShS's blog
  • Откуда: Default city
[Powershell] Логика работы Get-DnsServerResourceRecord
« Ответ #1 : 05 марта 2018, 20:55:55 »
А если не создавать/удалять, а повторно запросить - будет ошибка или пустота?

Оффлайн Retif

  • Администраторы
  • Олдфаг
  • *****
  • Сообщений: 9059
  • Рейтинг: 88
  • Пол: Мужской
  • Афтар
    • Просмотр профиля
    • Мой блог
  • Откуда: Орёл
[Powershell] Логика работы Get-DnsServerResourceRecord
« Ответ #2 : 05 марта 2018, 21:09:03 »
А если не создавать/удалять, а повторно запросить - будет ошибка или пустота?
Если не создавать, то ошибка, записи же нет. Вот что есть после удаления записи, это мне непонятно.

Оффлайн shs

  • Модератор
  • Ветеран
  • *****
  • Сообщений: 4401
  • Рейтинг: 89
    • Просмотр профиля
    • ShS's blog
  • Откуда: Default city
[Powershell] Логика работы Get-DnsServerResourceRecord
« Ответ #3 : 06 марта 2018, 12:53:04 »
Если не создавать, то ошибка, записи же нет.
Вопрос относился к повторному опросу (при условии, что запись не создавалась и не удалялась).

Оффлайн Retif

  • Администраторы
  • Олдфаг
  • *****
  • Сообщений: 9059
  • Рейтинг: 88
  • Пол: Мужской
  • Афтар
    • Просмотр профиля
    • Мой блог
  • Откуда: Орёл
[Powershell] Логика работы Get-DnsServerResourceRecord
« Ответ #4 : 06 марта 2018, 13:11:13 »
shs, ну так я тебе и ответил про это.

PS D:\> Get-DnsServerResourceRecord -ComputerName dc.domain.local -ZoneName domain.local -Name test02
Get-DnsServerResourceRecord : Failed to get test02 record in domain.local zone on dc.domain.local server.
At line:1 char:1
+ Get-DnsServerResourceRecord -ComputerName dc.domain.local -ZoneName do ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : ObjectNotFound: (test02:root/Microsoft/...rResourceRecord) [Get-DnsServerResourceRecord], CimException
    + FullyQualifiedErrorId : WIN32 9714,Get-DnsServerResourceRecord
 

PS D:\> Get-DnsServerResourceRecord -ComputerName dc.domain.local -ZoneName domain.local -Name test02
Get-DnsServerResourceRecord : Failed to get test02 record in domain.local zone on dc.domain.local server.
At line:1 char:1
+ Get-DnsServerResourceRecord -ComputerName dc.domain.local -ZoneName do ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : ObjectNotFound: (test02:root/Microsoft/...rResourceRecord) [Get-DnsServerResourceRecord], CimException
    + FullyQualifiedErrorId : WIN32 9714,Get-DnsServerResourceRecord
 

Оффлайн shs

  • Модератор
  • Ветеран
  • *****
  • Сообщений: 4401
  • Рейтинг: 89
    • Просмотр профиля
    • ShS's blog
  • Откуда: Default city
[Powershell] Логика работы Get-DnsServerResourceRecord
« Ответ #5 : 06 марта 2018, 14:16:08 »
тогда мыслей нет ... Видимо, косяк какой-то

Оффлайн shurutov

  • Постоялец
  • ***
  • Сообщений: 326
  • Рейтинг: 3
  • Пол: Мужской
    • mshurutov@jabber.ru
    • Просмотр профиля
  • Откуда: СССР
[Powershell] Логика работы Get-DnsServerResourceRecord
« Ответ #6 : 07 марта 2018, 23:40:04 »
Вопрос, что происходит, собственно?  ???
Кэш? Ты его после удаления записи на всех ДНС-серверах сбрасывал? Я всякое видел, связанное именно с этим, что на винде, что на бинде. А если твой запрос уходит на какой-нибудь ведомый ДНС-сервер, то с кешами вообще бывает забавно.
С уважением,
Шурутов Михаил.

Оффлайн Retif

  • Администраторы
  • Олдфаг
  • *****
  • Сообщений: 9059
  • Рейтинг: 88
  • Пол: Мужской
  • Афтар
    • Просмотр профиля
    • Мой блог
  • Откуда: Орёл
[Powershell] Логика работы Get-DnsServerResourceRecord
« Ответ #7 : 07 марта 2018, 23:52:30 »
shurutov, сбрасывал, не кэш это. Это винда :)

Вот ответ с технета:

Цитировать
Зона DNS интегрирована в AD?  Если да, то:

When Active Directory deletes an object from the directory, it does not immediately remove the object from the database. Instead, Active Directory marks the object as deleted by setting the object’s isDeleted attribute to TRUE, stripping most of the attributes from the object, renaming the object, and then moving the object to a special container in the object’s naming context (NC) named CN=Deleted Objects. This object is called a tombstone and is used to replicate the object’s deletion throughout the Active Directory environment. Over time (default 60 days), the tombstone is removed and the object is truly gone from AD. DNS objects, however, have their own process of deletion – once the DNS zone is integrated in the Active Directory, all the DNS records become Active Directory objects but they get an attribute called “dNSTombstoned” attached to them.
A DNS record gets removed by either of the following methods:

    Scavenging
    Manual deletion
    When it gets a valid TTL update with TTL=0
    An LDAP delete command using interfaces such as ADSIEDIT or LDP

If the DNS record is getting deleted by any of the first 3 ways then the value of the dNSTombstoned attribute attached to it will become “TRUE”. In this scenario the records will still exist in Active Directory but DNS.exe will not load them in the MMC. This is because for DNS they are deleted, but for Active Directory they still exist as a valid AD object. We can still see them using ADSIEDIT. When the record is in this state in the Active Directory the value of dNSTombstoned can change to “FALSE” either when the host machine/DHCP sends an update for the record or by creating another record with the same name manually. When this happens, DNS.exe will start loading the record again in the MMC. If the DNS record is being deleted by the 4th method or if the record stays in the state of dNSTombstoned=TRUE for more than 7 days then it will be tombstoned (AD tombstoned) like any other AD object.

When the Accesses is “Write property” it means that the value of dNSTombstoned has been either changed to TRUE/FALSE or the time stamp on the record was updated and if the Accesses is “Deleted” then it means that the record has been AD tombstoned.

Т.е. объект как бы ещё существует, но вот свойства команда не отдаёт