---
sourceDocument: オーストラリア API リファレンス
sourceDocumentLink: https://servicenow-prod.fluidtopics.net/r/ja-JP/api-reference

 Release :

    - australia

ft:locale :

    - ja-JP

ft:publication_title :

    - オーストラリア API リファレンス

ft:clusterId :

    - crapiref

bundleId :

    - crapiref

workflow :

    - Creator


---

# IPAddressFixup - グローバル

# IPAddressFixup - グローバル {#ariaid-title1}

* リリースバージョン: Australia
* 
* 更新日 2026年03月12日
* 
* ![](https://www.servicenow.com/docs/portal-asset/ico-clock) 所要時間：11分

IPAddressFixup スクリプトインクルードは、デバイスが正常に検出された後に、他のデバイスが同じ IP アドレスを持つことがないようにするメソッドを提供します。重複が見つかった場合、\[IP アドレス\] フィールドはクリアされます。

任意のサーバー側ディスカバリースクリプトとともに使用して、IP アドレスを検証します。

## IPAddressFixup - dedupe(String tableName, String ip) {#ariaid-title2}

指定されたテーブルから指定された IP アドレスの重複を削除します。
デバイスが正常に検出されたら、 dedupe() メソッドを使用して、そのデバイスの重複 IP アドレスを削除できます。
{#r_IPAF-dedupe_S_S__table_hsd_nnq_pt__entry__3}

| 名前 | タイプ | 説明 |
|-|-|-|
| tableName | 文字列 | 重複をチェックするテーブル。 |
| ip | 文字列 | 確認する IP アドレス。 |
[表 : 1. パラメーター]

{#r_IPAF-dedupe_S_S__table_hsd_nnq_pt} {#r_IPAF-dedupe_S_S__table_isd_nnq_pt__entry__2}

| タイプ | 説明 |
|-|-|
| なし |   |
[表 : 2. 返される内容]

{#r_IPAF-dedupe_S_S__table_isd_nnq_pt}  
次の例は、バックグラウンドスクリプトで dedupe() を使用して、cmdb_ci_hardware テーブル内の指定された IP アドレスの重複する IP アドレスを削除する方法を示しています。

    var grDiscovery=new GlideRecord("discovery_device_history");
    grDiscovery.addQuery('sys_id','<sys id of the record>'); // sys_id of the device discovery_device_history
    grDiscovery.query();
    if(grDiscovery.next())
      {
        var fx=new IPAddressFixup(grDiscovery.cmdb_ci); // Instantiate IPAddressFixup - pass cmdb reference 
        fx.dedupe('cmdb_ci_hardware','192.161.1.1'); // Pass the IP address and table which removes duplicates of the specified IP address in the specified table.
      }

次の例は、ビジネスルールで dedupe() を使用して、cmdb_ci_hardware テーブル内の指定された IP アドレスの重複する IP アドレスを削除する方法を示しています。

    (function executeRule(current, previous /*null when async*/) {

    var cmdb_ci = current.cmdb_ci + '';
    if (cmdb_ci) 
      {
        var ipf = new IPAddressFixup(cmdb_ci); // Instantiate IPAddressFixup - pass cmdb reference
        ipf.dedupe('cmdb_ci_hardware','168.128.1.1'); // Removes duplicates of the specified IP address in the specified table.
      }
    })(current, previous);

## IPAddressFixup - dedupeAll() {#ariaid-title3}

テーブルから重複するすべての IP アドレスを削除します。
{#r_IPAF-dedupeAll__table_fq1_hnq_pt__entry__3}

| 名前 | タイプ | 説明 |
|-|-|-|
| なし |   |   |
[表 : 3. パラメーター]

{#r_IPAF-dedupeAll__table_fq1_hnq_pt} {#r_IPAF-dedupeAll__table_gq1_hnq_pt__entry__2}

| タイプ | 説明 |
|-|-|
| なし |   |
[表 : 4. 返される内容]

{#r_IPAF-dedupeAll__table_gq1_hnq_pt}  
次の例は、バックグラウンドスクリプトで dedupeAll() を使用して重複するすべての IP アドレスを削除する方法を示しています。

    var grDiscovery=new GlideRecord("discovery_device_history"); 
    grDiscovery.addQuery('sys_id','<sys id of the record>'); // sys_id of the device discovery_device_history
    grDiscovery.query();
    if(grDiscovery.next())
    {
      var fx=new IPAddressFixup(grDiscovery.cmdb_ci); // Call script include IPAddressFixup and pass cmdb reference
      fx.dedupeAll(); //Removes all duplicate IP addresses from the tables.
    }

次の例は、ビジネスルールで dedupeAll() を使用してすべての重複 IP アドレスを削除する方法を示しています。

    (function executeRule(current, previous /*null when async*/) {

    var cmdb_ci = current.cmdb_ci + '';
    if (cmdb_ci) 
    {
      var ipf = new IPAddressFixup(cmdb_ci); //call script include IPAddressFixup and pass cmdb reference
      ipf.dedupeAll(); //Removes all duplicate IP addresses from the tables.
    })(current, previous);

## IPAddressFixup - fix() {#ariaid-title4}

重複する IP アドレスをすべて削除し、親 ip_address レコードがネットワークインターフェイスカード (NIC) のいずれかの IP アドレスに設定されていることを確認します。
デバイスが正常に検出されたら、 dedupe() メソッドを使用して、そのデバイスの重複する IP アドレスを削除し、親ip_addressレコードの値を設定できます。
{#r_IPAF-fix__table_bfp_dmq_pt__entry__3}

| 名前 | タイプ | 説明 |
|-|-|-|
| なし |   |   |
[表 : 5. パラメーター]

{#r_IPAF-fix__table_bfp_dmq_pt} {#r_IPAF-fix__table_cfp_dmq_pt__entry__2}

| タイプ | 説明 |
|-|-|
| なし |   |
[表 : 6. 返される内容]

{#r_IPAF-fix__table_cfp_dmq_pt}  
次の例は、バックグラウンドスクリプトで fix() を使用して重複するIPアドレスを削除し、親IPアドレスを設定する方法を示しています。

    var grDiscovery=new GlideRecord("discovery_device_history"); 
    grDiscovery.addQuery('sys_id','<sys id of the the record>'); // sys_id of the device discovery_device_history
    grDiscovery.query();
    if(grDiscovery.next())
      {
        var fx=new IPAddressFixup(grDiscovery.cmdb_ci); // Instantiate IPAddressFixup - pass cmdb reference
        fx.fix(); // Remove all duplicate IP addresses and ensure that the parent ip_address record is set to one of the NIC's IP addresses.
      }

次の例は、ビジネスルールで fix() を使用して重複する IP アドレスを削除し、親 IP アドレスを設定する方法を示しています。

    (function executeRule(current, previous /*null when async*/) {

    var cmdb_ci = current.cmdb_ci + '';
    if (cmdb_ci) 
      {
        var ipf = new IPAddressFixup(cmdb_ci); // Instantiate IPAddressFixup - pass cmdb reference
        ipf.fix(); /// Remove all duplicate IP addresses and ensure that the parent ip_address record is set to one of the NIC's IP addresses.
      }
    })(current, previous);

## IPAddressFixup - getParentIP() {#ariaid-title5}

現在のデバイスの親 IP アドレスを返します。
{#r_IPAF-getParentIP__table_ulc_1nq_pt__entry__3}

| 名前 | タイプ | 説明 |
|-|-|-|
| なし |   |   |
[表 : 7. パラメーター]

{#r_IPAF-getParentIP__table_ulc_1nq_pt} {#r_IPAF-getParentIP__table_vlc_1nq_pt__entry__2}

| タイプ | 説明 |
|-|-|
| 文字列 | 親 IP アドレス |
[表 : 8. 返される内容]

{#r_IPAF-getParentIP__table_vlc_1nq_pt}  
次の例は、バックグラウンドスクリプトで getParentIP() を使用して親 IP アドレスを取得する方法を示しています。

    var grDiscovery=new GlideRecord("discovery_device_history"); // current.cmdb_ci can be used in case of Business rule on discovery_device_history table
    grDiscovery.addQuery('sys_id','<sys id of the the record>'); // sys_id of the device discovery_device_history
    grDiscovery.query();
    if(grDiscovery.next())
      {
        var fx=new IPAddressFixup(grDiscovery.cmdb_ci); // Instantiate IPAddressFixup - pass cmdb reference
        gs.info(fx.getParentIP()); // Display the parent IP address of the device 
      }

出力:

    172.21.12.11

次の例は、ビジネスルールで getParentIP() を使用して親 IP アドレスを取得する方法を示しています。

    ((function executeRule(current, previous /*null when async*/) {

    var cmdb_ci = current.cmdb_ci + '';
    if (cmdb_ci) 
      {
        var ipf = new IPAddressFixup(cmdb_ci); // Instantiate IPAddressFixup - pass cmdb reference
        gs.log(ipf.getParentIP()); // Log the parent IP address of the device. Located in the system logs table 
      }
    })(current, previous);

## IPAddressFixup - setParentIP(文字列 ip) {#ariaid-title6}

現在の CI の親 IP アドレスフィールドを設定します。
{#r_IPAF-setParentIP_S__table_bgs_rmq_pt__entry__3}

| 名前 | タイプ | 説明 |
|-|-|-|
| ip | 文字列 | 現在の CI の親 IP アドレス。 |
[表 : 9. パラメーター]

{#r_IPAF-setParentIP_S__table_bgs_rmq_pt} {#r_IPAF-setParentIP_S__table_cgs_rmq_pt__entry__2}

| タイプ | 説明 |
|-|-|
| なし |   |
[表 : 10. 返される内容]

{#r_IPAF-setParentIP_S__table_cgs_rmq_pt}  
次の例は、バックグラウンドスクリプトで setParentIP() を使用して親 IP アドレスを格納する方法を示しています。

    var grDiscover=new GlideRecord("discovery_device_history"); 
    grDiscover.addQuery('sys_id','a14e43b31bb4051070cb96c6b04bcb23'); // sys_id of the device in discovery_device_history table. Put your own sys_id here.
    grDiscover.query();
    if(grDiscover.next())
      {
        var fx=new IPAddressFixup(grDiscover.cmdb_ci); // Instantiate IPAddressFixup - pass cmdb reference.
        fx.setParentIP('197.111.1.1'); // Pass IP address to set as new IP on current mentioned CI.
      }

次の例は、ビジネスルールで setParentIP() を使用して親 IP アドレスを格納する方法を示しています。

    ((function executeRule(current, previous /*null when async*/) {

    var cmdb_ci = current.cmdb_ci + '';
    if (cmdb_ci) 
      {
        var ipf = new IPAddressFixup(cmdb_ci); // Instantiate IPAddressFixup - pass cmdb reference
        fx.setParentIP('195.11.1.1'); // Set the new IP address of the CI 
      }
    })(current, previous);

## IPAddressFixup - syncIP() {#ariaid-title7}

親 ip_address レコードが NIC の IP アドレスのいずれかに設定されていることを確認するか、NIC がない場合はそのままにします。
{#r_IPAF-syncIP__table_ywk_kmq_pt__entry__3}

| 名前 | タイプ | 説明 |
|-|-|-|
| なし |   |   |
[表 : 11. パラメーター]

{#r_IPAF-syncIP__table_ywk_kmq_pt} {#r_IPAF-syncIP__table_zwk_kmq_pt__entry__2}

| タイプ | 説明 |
|-|-|
| なし |   |
[表 : 12. 返される内容]

{#r_IPAF-syncIP__table_zwk_kmq_pt}  
これは、バックグラウンドスクリプトで syncIP() メソッドを使用する例を示しています。

    var grDevHistory=new GlideRecord("discovery_device_history");
    grDevHistory.addQuery('sys_id','a14e43b31bb4051070cb96c6b04bcb23'); // Sys_id of the device in discovery_device_history table. Put your own sys_id here.
    grDevHistory.query();
    if(grDevHistory.next())
      {
        var fx=new IPAddressFixup(grDevHistory.cmdb_ci); // Call the script include IPAddressFixup and pass cmdb reference
        fx.syncIP(); // Ensures that the parent ip_address record is set to one of the NIC's IP addresses, or leaves it alone if there were no NICs.
      }

これは、ビジネスルールで syncIP() メソッドを使用する例を示しています。

    (function executeRule(current, previous /*null when async*/) {

    var cmdb_ci = current.cmdb_ci + '';
    if (cmdb_ci) 
      {
        var ipf = new IPAddressFixup(cmdb_ci); // Call script include IPAddressFixup and pass cmdb reference
        ipf.syncIP(); // Ensures that the parent ip_address record is set to one of the NIC's IP addresses, or leaves it alone if there were no NICs.
      }
    })(current, previous);


