AskOverflow.Dev

AskOverflow.Dev Logo AskOverflow.Dev Logo

AskOverflow.Dev Navigation

  • 主页
  • 系统&网络
  • Ubuntu
  • Unix
  • DBA
  • Computer
  • Coding
  • LangChain

Mobile menu

Close
  • 主页
  • 系统&网络
    • 最新
    • 热门
    • 标签
  • Ubuntu
    • 最新
    • 热门
    • 标签
  • Unix
    • 最新
    • 标签
  • DBA
    • 最新
    • 标签
  • Computer
    • 最新
    • 标签
  • Coding
    • 最新
    • 标签
主页 / server / 问题 / 725323
Accepted
Afroz
Afroz
Asked: 2015-09-29 07:34:10 +0800 CST2015-09-29 07:34:10 +0800 CST 2015-09-29 07:34:10 +0800 CST

使用 Get-DnsServerResourceRecord 检索“与父文件夹相同”的记录

  • 772

我正在尝试从区域中检索单个 A 记录。这是我正在使用的 Powershell 命令(仅显示相关列)

Get-DnsServerResourceRecord -zonename search.contoso.com -computername g-dc03 -RRType A

HostName                  RecordType RecordData
--------                  ---------- ----------
@                         A          192.23.12.40
stg                       A          172.25.77.56

在“DNS 管理器”GUI 中,我看到第一条记录为“与父文件夹相同”。我只想检索这一条记录,而不是 stg 记录。我尝试使用以下命令但失败了,它们都导致相同的 2 行。

Get-DnsServerResourceRecord -zonename search.contoso.com -computername g-dc03 -RRType A -Name "."
Get-DnsServerResourceRecord -zonename search.contoso.com -computername g-dc03 -RRType A -Name '.'

Get-DnsServerResourceRecord -zonename search.contoso.com -computername g-dc03 -RRType A -Name search.contoso.com

HostName                  RecordType RecordData
--------                  ---------- ----------
search.contoso.com        A          192.23.12.40
stg                       A          172.25.77.56
domain-name-system
  • 1 1 个回答
  • 1485 Views

1 个回答

  • Voted
  1. Best Answer
    Drifter104
    2015-09-29T08:33:11+08:002015-09-29T08:33:11+08:00

    如果我理解正确,你想要这样的东西

    Get-DnsServerResourceRecord -ZoneName search.contoso.com -computername w-dc03 -RRType A | ? {$_.Hostname -like '@'}
    

    您可以替换@为任何搜索词,或者您可以将 更改-like '@'为-notlike 'stg'列出除记录之外的所有 Astg记录

    如果这不是您要查找的内容,请发表评论,我会进行相应修改

    编辑:不做同样的事情where

    Get-DnsServerResourceRecord -ZoneName search.contoso.com -computername w-dc03 -RRType A >> output.txt
    
    Select-String -Path .\output.txt -Pattern "(@|HostName)" |select line
    
    • 1

相关问题

  • Solaris DNS

  • resolv.conf 在经过一段时间后被更改

  • 为什么有些网站的网址中没有“www”就无法显示?[关闭]

  • 为本地网络中的名称解析添加自定义 dns 条目

Sidebar

Stats

  • 问题 205573
  • 回答 270741
  • 最佳答案 135370
  • 用户 68524
  • 热门
  • 回答
  • Marko Smith

    新安装后 postgres 的默认超级用户用户名/密码是什么?

    • 5 个回答
  • Marko Smith

    SFTP 使用什么端口?

    • 6 个回答
  • Marko Smith

    命令行列出 Windows Active Directory 组中的用户?

    • 9 个回答
  • Marko Smith

    什么是 Pem 文件,它与其他 OpenSSL 生成的密钥文件格式有何不同?

    • 3 个回答
  • Marko Smith

    如何确定bash变量是否为空?

    • 15 个回答
  • Martin Hope
    Tom Feiner 如何按大小对 du -h 输出进行排序 2009-02-26 05:42:42 +0800 CST
  • Martin Hope
    Noah Goodrich 什么是 Pem 文件,它与其他 OpenSSL 生成的密钥文件格式有何不同? 2009-05-19 18:24:42 +0800 CST
  • Martin Hope
    Brent 如何确定bash变量是否为空? 2009-05-13 09:54:48 +0800 CST
  • Martin Hope
    cletus 您如何找到在 Windows 中打开文件的进程? 2009-05-01 16:47:16 +0800 CST

热门标签

linux nginx windows networking ubuntu domain-name-system amazon-web-services active-directory apache-2.4 ssh

Explore

  • 主页
  • 问题
    • 最新
    • 热门
  • 标签
  • 帮助

Footer

AskOverflow.Dev

关于我们

  • 关于我们
  • 联系我们

Legal Stuff

  • Privacy Policy

Language

  • Pt
  • Server
  • Unix

© 2023 AskOverflow.DEV All Rights Reserve