Differences
This shows you the differences between two versions of the page.
| Both sides previous revisionPrevious revisionNext revision | Previous revision | ||
| ad.dns [2026/02/13 09:37] – jp | ad.dns [2026/03/12 09:59] (current) – jp | ||
|---|---|---|---|
| Line 6: | Line 6: | ||
| dnscmd /zoneexport zone_name " | dnscmd /zoneexport zone_name " | ||
| + | Если нам требуется регулярно выгружать содержимое зоны и копировать в определенную папку, поможет простой cmd-скрипт, | ||
| + | < | ||
| + | del " | ||
| + | dnscmd /zoneexport pcr.int " | ||
| + | xcopy /I /Y " | ||
| + | </ | ||
| + | |||
| Файл следует искать тут: | Файл следует искать тут: | ||
| Line 12: | Line 19: | ||
| | | ||
| + | ==== Скрипт получения настроек DNS адаптеров серверов в домене ==== | ||
| + | |||
| + | Скрипт принимает перечень серверов (или любых компьютеров), | ||
| + | |||
| + | < | ||
| + | $servers = Get-Content -Path " | ||
| + | |||
| + | $SuccessResults = @() | ||
| + | $ErrorResults | ||
| + | |||
| + | foreach ($server in $servers) { | ||
| + | |||
| + | Write-Host " | ||
| + | |||
| + | try { | ||
| + | $result = Invoke-Command -ComputerName $server ` | ||
| + | | ||
| + | | ||
| + | | ||
| + | } -ErrorAction Stop | ||
| + | |||
| + | foreach ($item in $result) { | ||
| + | $SuccessResults += [PSCustomObject]@{ | ||
| + | ComputerName | ||
| + | InterfaceAlias = $item.InterfaceAlias | ||
| + | ServerAddresses = ($item.ServerAddresses -join ", ") | ||
| + | Status | ||
| + | ErrorMessage | ||
| + | } | ||
| + | } | ||
| + | } | ||
| + | catch { | ||
| + | $ErrorResults += [PSCustomObject]@{ | ||
| + | ComputerName | ||
| + | InterfaceAlias = $null | ||
| + | ServerAddresses = $null | ||
| + | Status | ||
| + | ErrorMessage | ||
| + | } | ||
| + | |||
| + | Write-Host "Error on $server: $($_.Exception.Message)" | ||
| + | } | ||
| + | } | ||
| + | |||
| + | # Saving results | ||
| + | $SuccessResults | Export-Csv " | ||
| + | |||
| + | # Saving errors | ||
| + | $ErrorResults | Export-Csv " | ||
| + | |||
| + | Write-Host " | ||
| + | </ | ||
| {{tag> | {{tag> | ||