使用 Windows PowerShell 管理基于角色的访问控制
适用范围:Windows Server 2022、Windows Server 2019、Windows Server 2016
您可以使用本主题来了解如何使用 IPAM 通过 Windows PowerShell 来管理基于角色的访问控制。
备注
有关 IPAM Windows PowerShell 命令参考,请参阅Windows PowerShell 中的 IpamServer cmdlet。
新的 Windows PowerShell IPAM 命令使你能够检索和更改 DNS 和 DHCP 对象的访问作用域。 下表说明了要用于每个 IPAM 对象的正确命令。
IPAM 对象 | 命令 | 说明 |
---|---|---|
DNS 服务器 | Get-IpamDnsServer | 此 cmdlet 将返回中的 DNS 服务器对象 IPAM |
DNS 区域 | Get-IpamDnsZone | 此 cmdlet 将返回中的 DNS 区域对象 IPAM |
DNS 资源记录 | Get-IpamResourceRecord | 此 cmdlet 将返回中的 DNS 资源记录对象 IPAM |
DNS 条件转发器 | Get-IpamDnsConditionalForwarder | 此 cmdlet 将返回中的 DNS 条件转发器对象 IPAM |
DHCP 服务器 | Get-IpamDhcpServer | 此 cmdlet 将返回中的 DHCP 服务器对象 IPAM |
DHCP 超级作用域 | Get-IpamDhcpSuperscope | 此 cmdlet 将返回中的 DHCP 超级作用域对象 IPAM |
DHCP 作用域 | Get-IpamDhcpScope | 此 cmdlet 将返回中的 DHCP 作用域对象 IPAM |
在下面的命令输出示例中,cmdlet 将 Get-IpamDnsZone
检索 Get-IpamDnsZone
DNS 区域。
PS C:\Users\Administrator.CONTOSO> Get-IpamDnsZone -ZoneType Forward -ZoneName dublin.contoso.com
ZoneName : dublin.contoso.com
ZoneType : Forward
AccessScopePath : \Global\Dublin
IsSigned : False
DynamicUpdateStatus : None
ScavengeStaleRecords : False
IPAM 对象上设置访问作用域
您可以使用 Set-IpamAccessScope
命令对 IPAM 对象设置访问作用域。 您可以使用此命令将访问作用域设置为对象的特定值,或者使对象继承父对象的访问作用域。 下面是可以通过此命令配置的对象。
DHCP 作用域
DHCP 服务器
DHCP 超级作用域
DNS 条件转发器
DNS 资源记录
DNS 服务器
DNS 区域
IP 地址块
IP 地址范围
IP 地址空间
IP 地址子网
下面是命令的语法 Set-IpamAccessScope
。
NAME
Set-IpamAccessScope
SYNTAX
Set-IpamAccessScope [-IpamRange] -InputObject <ciminstance[]> [-AccessScopePath <string>] [-IsInheritedAccessScope] [-PassThru] [-CimSession <CimSession[]>] [-ThrottleLimit <int>] [-AsJob] [-WhatIf] [-Confirm] [<CommonParameters>]
Set-IpamAccessScope [-IpamDnsServer] -InputObject <ciminstance[]> [-AccessScopePath <string>] [-IsInheritedAccessScope] [-PassThru] [-CimSession <CimSession[]>] [-ThrottleLimit <int>] [-AsJob] [-WhatIf] [-Confirm]
[<CommonParameters>]
Set-IpamAccessScope [-IpamDhcpServer] -InputObject <ciminstance[]> [-AccessScopePath <string>] [-IsInheritedAccessScope] [-PassThru] [-CimSession <CimSession[]>] [-ThrottleLimit <int>] [-AsJob] [-WhatIf] [-Confirm]
[<CommonParameters>]
Set-IpamAccessScope [-IpamDhcpSuperscope] -InputObject <ciminstance[]> [-AccessScopePath <string>] [-IsInheritedAccessScope] [-PassThru] [-CimSession <CimSession[]>] [-ThrottleLimit <int>] [-AsJob] [-WhatIf] [-Confirm]
[<CommonParameters>]
Set-IpamAccessScope [-IpamDhcpScope] -InputObject <ciminstance[]> [-AccessScopePath <string>] [-IsInheritedAccessScope] [-PassThru] [-CimSession <CimSession[]>] [-ThrottleLimit <int>] [-AsJob] [-WhatIf] [-Confirm]
[<CommonParameters>]
Set-IpamAccessScope [-IpamDnsConditionalForwarder] -InputObject <ciminstance[]> [-AccessScopePath <string>] [-IsInheritedAccessScope] [-PassThru] [-CimSession <CimSession[]>] [-ThrottleLimit <int>] [-AsJob] [-WhatIf] [-Confirm]
[<CommonParameters>]
Set-IpamAccessScope [-IpamDnsResourceRecord] -InputObject <ciminstance[]> [-AccessScopePath <string>] [-IsInheritedAccessScope] [-PassThru] [-CimSession <CimSession[]>] [-ThrottleLimit <int>] [-AsJob] [-WhatIf] [-Confirm]
[<CommonParameters>]
Set-IpamAccessScope [-IpamDnsZone] -InputObject <ciminstance[]> [-AccessScopePath <string>] [-IsInheritedAccessScope] [-PassThru] [-CimSession <CimSession[]>] [-ThrottleLimit <int>] [-AsJob] [-WhatIf] [-Confirm]
[<CommonParameters>]
Set-IpamAccessScope [-IpamAddressSpace] -InputObject <ciminstance[]> [-AccessScopePath <string>] [-IsInheritedAccessScope] [-PassThru] [-CimSession <CimSession[]>] [-ThrottleLimit <int>] [-AsJob] [-WhatIf] [-Confirm]
[<CommonParameters>]
Set-IpamAccessScope [-IpamSubnet] -InputObject <ciminstance[]> [-AccessScopePath <string>] [-IsInheritedAccessScope] [-PassThru] [-CimSession <CimSession[]>] [-ThrottleLimit <int>] [-AsJob] [-WhatIf] [-Confirm] [<CommonParameters>]
Set-IpamAccessScope [-IpamBlock] -InputObject <ciminstance[]> [-AccessScopePath <string>] [-IsInheritedAccessScope] [-PassThru] [-CimSession <CimSession[]>] [-ThrottleLimit <int>] [-AsJob] [-WhatIf] [-Confirm] [<CommonParameters>]
在以下示例中,DNS 区域 dublin.contoso.com 的访问作用域从 都柏林 更改为 欧洲。
PS C:\Users\Administrator.CONTOSO> Get-IpamDnsZone -ZoneType Forward -ZoneName dublin.contoso.com
ZoneName : dublin.contoso.com
ZoneType : Forward
AccessScopePath : \Global\Dublin
IsSigned : False
DynamicUpdateStatus : None
ScavengeStaleRecords : False
PS C:\Users\Administrator.CONTOSO> $a = Get-IpamDnsZone -ZoneType Forward -ZoneName dublin.contoso.com
PS C:\Users\Administrator.CONTOSO> Set-IpamAccessScope -IpamDnsZone -InputObject $a -AccessScopePath \Global\Europe -PassThru
ZoneName : dublin.contoso.com
ZoneType : Forward
AccessScopePath : \Global\Europe
IsSigned : False
DynamicUpdateStatus : None
ScavengeStaleRecords : False