NewNetIPAddress:ActiveStore 与 PersistantStore
NewNetIPAddress: ActiveStore vs. PersistantStore
我正在尝试使用 powershell 脚本设置新的 IP 地址。我使用这个命令:
New-NetIPAddress -InterfaceAlias $interfaceName -IPAddress $_.IPAddress -AddressFamily IPv4 -PrefixLength $maskLegth
但是,在断开连接的接口上我收到此错误:
New-NetIPAddress : Inconsistent parameters PolicyStore PersistentStore and Dhcp Enabled
但是当我将 -PolicyStore 设置为 ActiveStore 时,脚本将 运行 没有错误:
New-NetIPAddress -InterfaceAlias $interfaceName -IPAddress $_.IPAddress -AddressFamily IPv4 -PrefixLength $maskLegth -PolicyStore ActiveStore
我不太确定 属性 的作用,因为重启后设置仍然存在。这里有什么缺点吗?或者为什么会出现这个错误?
New-NetIPAddress : Inconsistent parameters PolicyStore PersistentStore and Dhcp Enabled
PersistentStore 与 ActiveStore 是分开的,也有单独的 GPO store。
这些商店是防火墙和网络配置。
ActiveStore 包含此计算机的配置。
GPO 存储是来自本地组策略的配置。
活动存储是当前活动的配置,包括 GPO 和持久存储。
您遇到的问题是因为持久存储设置为 DHCP 并且您正在配置静态地址,这没有意义。
首先在活动存储中禁用 DHCP,然后为接口设置 IP。
有关这些商店的信息以及如何设置它们,请参阅:
https://docs.microsoft.com/en-us/powershell/module/netsecurity/set-netfirewallsetting?view=win10-ps
我正在尝试使用 powershell 脚本设置新的 IP 地址。我使用这个命令:
New-NetIPAddress -InterfaceAlias $interfaceName -IPAddress $_.IPAddress -AddressFamily IPv4 -PrefixLength $maskLegth
但是,在断开连接的接口上我收到此错误:
New-NetIPAddress : Inconsistent parameters PolicyStore PersistentStore and Dhcp Enabled
但是当我将 -PolicyStore 设置为 ActiveStore 时,脚本将 运行 没有错误:
New-NetIPAddress -InterfaceAlias $interfaceName -IPAddress $_.IPAddress -AddressFamily IPv4 -PrefixLength $maskLegth -PolicyStore ActiveStore
我不太确定 属性 的作用,因为重启后设置仍然存在。这里有什么缺点吗?或者为什么会出现这个错误?
New-NetIPAddress : Inconsistent parameters PolicyStore PersistentStore and Dhcp Enabled
PersistentStore 与 ActiveStore 是分开的,也有单独的 GPO store。
这些商店是防火墙和网络配置。
ActiveStore 包含此计算机的配置。 GPO 存储是来自本地组策略的配置。 活动存储是当前活动的配置,包括 GPO 和持久存储。
您遇到的问题是因为持久存储设置为 DHCP 并且您正在配置静态地址,这没有意义。
首先在活动存储中禁用 DHCP,然后为接口设置 IP。
有关这些商店的信息以及如何设置它们,请参阅: https://docs.microsoft.com/en-us/powershell/module/netsecurity/set-netfirewallsetting?view=win10-ps