如何在没有DnsServer模块的情况下使用PowerShell检索所有DNS记录?

问题描述 投票:1回答:1

我正在使用Windows Server 2008 R2。我发现的每个帖子都建议将DnsServer模块用于Powershell,但是这些机器不支持该模块。那么我还能如何获得这些记录?我正在尝试将它们导出到CSV文件。 “ nslookup”并不能真正解决问题。

powershell sql-server-2008 dns windows-7
1个回答
0
投票

至于...我正在使用Windows Server 2008 R2。我发现的每个帖子都建议将DnsServer模块用于Powershell,但是这些机器不支持该模块。...那不是有效的声明。 Win7和W2K8支持它们。哎呀,您可以在Vista上使用它们-根据Microsoft的记录。

Description of Windows Server 2008 Remote Server Administration Tools for Windows Vista Service Pack 1

系统要求

RSAT可以安装在以下32位和64位版本上配置:Windows Vista Ultimate SP1或更高版本的WindowsVista Service Pack

  • 带有SP1的Windows Vista Enterprise或更高版本的Windows Vista Service Pack
  • 带有SP1的Windows Vista Business或更高版本的Windows Vista Service Pack
  • RSAT可用于管理Windows Server 2008的32位和64位版本。

RSAT不应安装在运行Windows的计算机上Server 2003管理工具包或Windows 2000 Server管理工具包。请删除所有管理工具包安装RSAT之前从计算机上下载版本。

一次只能在一台计算机上安装RSAT的一个副本。在安装新软件包之前,请删除以下任何现有版本的RSAT。这包括任何使用不同语言的副本。

您需要在Win7主机上安装RAT工具,必须在W2K8上启用它们。

Remote Server Administration Tools for Windows 7 with Service Pack 1 (SP1)

实际上,如果不允许的话。您不需要安装RSAT工具,可以从任何运行RSAT的DC或服务器将它们代理到工作站。这是一种非常常见的做法,称为隐式远程处理,并且在网络上的大量资源中都有详细记录。否则,您需要使用ADSI,.Net库或其他3rdP工具。

使用诸如“不安装而使用PowerShell Active Directory Cmdlet”或“ Windows 7获取dns记录”的快速搜索将为您提供带有示例的列表。

Use PowerShell Active Directory Cmdlets Without Installing Any Software

Using AD module without loading RSAT

因此,您然后可以使用以下示例从远程Windows Server 2008 R2(DC或成员服务器或安装了RSAT for AD的工作站)导入Active Directory cmdlet:

$session = New-PSSession -computerName 'TargetMachineWithRsat'
Invoke-Command { Import-Module ActiveDirectory } -Session $session
Import-PSSession $session

另一种方法是将远程PowerShell会话导出到本地模块:

$session = New-PSSession -computerName 'TargetMachineWithRsat'
Invoke-Command { Import-Module ActiveDirectory } -Session $session
Export-PSSession -Session $session -CommandName *-AD* -Outputmodule ActiveDirectory -AllowClobber

使用]加载模块>

Import-Module ActiveDirectory
© www.soinside.com 2019 - 2024. All rights reserved.