Set-NetIPAddress

Set-NetIPAddress

Modifies the configuration of an IP address.

構文

Parameter Set: Query (cdxml)
Set-NetIPAddress [[-IPAddress] <String[]> ] [-AddressFamily <AddressFamily[]> ] [-AddressState <AddressState[]> ] [-CimSession <CimSession[]> ] [-IncludeAllCompartments] [-InterfaceAlias <String[]> ] [-InterfaceIndex <UInt32[]> ] [-PassThru] [-PolicyStore <String> ] [-PreferredLifetime <TimeSpan> ] [-PrefixLength <Byte> ] [-PrefixOrigin <PrefixOrigin[]> ] [-SkipAsSource <Boolean> ] [-SuffixOrigin <SuffixOrigin[]> ] [-ThrottleLimit <Int32> ] [-Type <Type[]> ] [-ValidLifetime <TimeSpan> ] [-Confirm] [-WhatIf] [ <CommonParameters>] [ <WorkflowParameters>]

Parameter Set: InputObject (cdxml)
Set-NetIPAddress [-CimSession <CimSession[]> ] [-PassThru] [-PreferredLifetime <TimeSpan> ] [-PrefixLength <Byte> ] [-SkipAsSource <Boolean> ] [-ThrottleLimit <Int32> ] [-ValidLifetime <TimeSpan> ] [-Confirm] [-WhatIf] [ <CommonParameters>] [ <WorkflowParameters>]

詳細説明

The Set-NetIPAddress cmdlet modifies IP address configuration properties of an existing IP address.

To create an IPv4 address or IPv6 address, use the New-NetIPAddress cmdlet.

パラメーター

-AddressFamily<AddressFamily[]>

Specifies an array of IP address families. The cmdlet modifies the IP address configuration that matches the families. このパラメーターに指定できる値は、次のとおりです。

-- IPv4
-- IPv6

Aliases

none

必須/オプション

false

位置

named

既定値

none

パイプライン入力の受け入れ

false

ワイルドカード文字の受け入れ

false

-AddressState<AddressState[]>

Specifies an array of duplicate address detection (DAD) state values for the IP address. このパラメーターに指定できる値は、次のとおりです。

-- Invalid. IP address configuration information for addresses that are not valid and will not be used.
-- Tentative. IP address configuration information for addresses that are not used for communication, as the uniqueness of those IP addresses is being verified.
-- Duplicate. IP address configuration information for addresses for which a duplicate IP address has been detected and the current IP address will not be used.
-- Deprecated. IP address configuration information for addresses that will no longer be used to establish new connections, but will continue to be used with existing connections.
-- Preferred. IP address configuration information for addresses that are valid and available for use.

Aliases

none

必須/オプション

false

位置

named

既定値

none

パイプライン入力の受け入れ

false

ワイルドカード文字の受け入れ

false

-CimSession<CimSession[]>

リモート セッションまたはリモート コンピューターでコマンドレットを実行します。コンピューター名またはセッション オブジェクト (New-CimSession コマンドレットや Get-CimSession コマンドレットの出力など) を入力します。既定値は、ローカル コンピューター上の現在のセッションです。

Aliases

Session

必須/オプション

false

位置

named

既定値

none

パイプライン入力の受け入れ

false

ワイルドカード文字の受け入れ

false

-IncludeAllCompartments

Indicates that the cmdlet includes addresses from all configured network compartments. If you do not specify this parameter, the cmdlet modifies only addresses in the default network compartment.

Aliases

none

必須/オプション

false

位置

named

既定値

none

パイプライン入力の受け入れ

false

ワイルドカード文字の受け入れ

false

-InterfaceAlias<String[]>

Specifies an array of aliases of network interfaces. The cmdlet modifies IP addresses that match the aliases.

Aliases

ifAlias

必須/オプション

false

位置

named

既定値

none

パイプライン入力の受け入れ

True (ByPropertyName)

ワイルドカード文字の受け入れ

false

-InterfaceIndex<UInt32[]>

Specifies an array of indexes of network interfaces. The cmdlet modifies IP addresses that match the indexes.

Aliases

ifIndex

必須/オプション

false

位置

named

既定値

none

パイプライン入力の受け入れ

True (ByPropertyName)

ワイルドカード文字の受け入れ

false

-IPAddress<String[]>

Specifies an array of IPv4 or IPv6 addresses.

Aliases

LocalAddress

必須/オプション

false

位置

1

既定値

none

パイプライン入力の受け入れ

True (ByPropertyName)

ワイルドカード文字の受け入れ

false

-PassThru

作業中の項目を表すオブジェクトを返します。既定では、このコマンドレットから出力は生成されません。

Aliases

none

必須/オプション

false

位置

named

既定値

none

パイプライン入力の受け入れ

false

ワイルドカード文字の受け入れ

false

-PolicyStore<String>

Specifies a PolicyStore value. このパラメーターに指定できる値は、次のとおりです。

-- ActiveStore. The IP address information is valid.
-- PersistentStore. The computer saves IP address information across restarts. When the computer restarts, it copies the saved settings to the ActiveStore.

The default value is ActiveStore. Specify ActiveStore only.

If you do not specify this parameter, the default entries are created in both the ActiveStore and the PersistentStore.

Aliases

none

必須/オプション

false

位置

named

既定値

none

パイプライン入力の受け入れ

false

ワイルドカード文字の受け入れ

false

-PreferredLifetime<TimeSpan>

Specifies a preferred lifetime, as a TimeSpan object, for an IP address. To obtain a TimeSpan object, use the New-TimeSpan cmdlet.

Aliases

none

必須/オプション

false

位置

named

既定値

none

パイプライン入力の受け入れ

false

ワイルドカード文字の受け入れ

false

-PrefixLength<Byte>

Specifies a prefix length. This parameter defines the local subnet size, and is also known as a subnet mask.

Aliases

none

必須/オプション

false

位置

named

既定値

none

パイプライン入力の受け入れ

false

ワイルドカード文字の受け入れ

false

-PrefixOrigin<PrefixOrigin[]>

Aliases

none

必須/オプション

false

位置

named

既定値

none

パイプライン入力の受け入れ

false

ワイルドカード文字の受け入れ

false

-SkipAsSource<Boolean>

Indicates whether an address is a primary IP address. This parameter identifies the primary IP address for outgoing traffic in a multiple IP address scenario. If this parameter is set to True, the address is not used for outgoing traffic and is not registered in DNS.

Aliases

none

必須/オプション

false

位置

named

既定値

none

パイプライン入力の受け入れ

false

ワイルドカード文字の受け入れ

false

-SuffixOrigin<SuffixOrigin[]>

Specifies an array of origins for address suffixes. IP addresses are divided into two parts, the prefix and the suffix. The address prefix identifies the network portion of an IP address, and the address suffix identifies the host portion. このパラメーターに指定できる値は、次のとおりです。

-- Manual. The IP address suffix was manually specified.
-- WellKnown. The IP address suffix is from a well-known source.
-- DHCP. The IP address suffix was provided by DHCP settings.
-- Link. The IP address suffix was obtained from the link-layer address.
-- Random. The IP address suffix was obtained from a random source.

Aliases

none

必須/オプション

false

位置

named

既定値

none

パイプライン入力の受け入れ

false

ワイルドカード文字の受け入れ

false

-ThrottleLimit<Int32>

コマンドレットを実行する際に確立できる同時実行操作の最大数を指定します。このパラメーターを省略するか、値 0 を入力した場合、コンピューター上で実行されている CIM コマンドレットの数に基づいて、コマンドレットに最適なスロットル制限が Windows PowerShell® によって計算されます。スロットル制限は、セッションやコンピューターではなく、現在のコマンドレットにのみ適用されます。

Aliases

none

必須/オプション

false

位置

named

既定値

none

パイプライン入力の受け入れ

false

ワイルドカード文字の受け入れ

false

-Type<Type[]>

Specifies an array of IP address types. このパラメーターに指定できる値は、次のとおりです。

-- Unicast
-- Anycast

The default value is Unicast.

Aliases

none

必須/オプション

false

位置

named

既定値

none

パイプライン入力の受け入れ

false

ワイルドカード文字の受け入れ

false

-ValidLifetime<TimeSpan>

Specifies a valid lifetime, as a TimeSpan object, for an IP address. To obtain a TimeSpan object, use the New-TimeSpan cmdlet.

Aliases

none

必須/オプション

false

位置

named

既定値

none

パイプライン入力の受け入れ

false

ワイルドカード文字の受け入れ

false

-Confirm

コマンドレットを実行する前に確認メッセージを表示します。

必須/オプション

false

位置

named

既定値

false

パイプライン入力の受け入れ

false

ワイルドカード文字の受け入れ

false

-WhatIf

コマンドレットが実行された場合に何が起きるのかを示します。コマンドレットは実行されません。

必須/オプション

false

位置

named

既定値

false

パイプライン入力の受け入れ

false

ワイルドカード文字の受け入れ

false

<CommonParameters>

このコマンドレットは共通のパラメーターをサポートしています(-Verbose、-Debug、-ErrorAction、-ErrorVariable、-OutBuffer、および -OutVariable)。詳細については、TechNet の「 「about_CommonParameters」 (https://go.microsoft.com/fwlink/p/?LinkID=113216) を参照してください。

<WorkflowParameters>

入力

入力型は、コマンドレットにパイプできるオブジェクトの型です。

  • Microsoft.Management.Infrastructure.CimInstance#root\StandardCimv2\MSFT_NetIPAddress

    Microsoft.Management.Infrastructure.CimInstance オブジェクトは、Windows Management Instrumentation (WMI) オブジェクトを表示するラッパー クラスです。基になる WMI オブジェクトの名前空間とクラス名は、シャープ記号 (#) に続くパスで指定されます。

出力

出力型は、コマンドレットが出力するオブジェクトの型です。

  • None

使用例

Example 1: Modify an IP address

This command adds the IP address 192.168.0.1 to the interface located at index 12.

The PrefixLength parameter may also be specified as part of the Set-NetIPAddress cmdlet.

PS C:\> Set-NetIPAddress –InterfaceIndex 12 –IPAddress 192.168.0.1
PS C:\> Set-NetIPAddress –InterfaceIndex 12 –IPAddress 192.168.0.1 –PrefixLength 24

Example 2: Modify an IP address and set the valid lifetime

The first command creates a new TimeSpan object of one day, and stores it in the variable named $Timesp.

The second command then uses the TimeSpan object to set the preferred lifetime of the IP address located at interface 12 to one day.

PS C:\> $Timesp = ( New-TimeSpan –Days 1 )
PS C:\> Set-NetIPAddress –InterfaceIndex 12 –IPAddress 192.168.0.1 –PreferredLifetime $Timesp

関連項目

Get-NetIPAddress

New-NetIPAddress

Remove-NetIPAddress

New-TimeSpan