[comment]: # ({e5a46c74-e5a46c74})
# script.getscriptsbyhosts

[comment]: # ({/e5a46c74-e5a46c74})

[comment]: # ({dfaa829b-dfaa829b})
### Opis

`object script.getscriptsbyhosts(array hostIds)`

Ta metoda pozwala na pobranie skryptów dostępnych na podanych hostach.

::: noteclassic
Ta metoda jest dostępna dla użytkowników dowolnego typu. Uprawnienia 
do jej wywołania mogą zostać cofnięte w ustawieniach ról użytkownika. Zobacz [Role 
użytkowników](/manual/web_interface/frontend_sections/administration/user_roles)
, aby uzyskać więcej informacji.
:::

[comment]: # ({/dfaa829b-dfaa829b})

[comment]: # ({080ad0f7-080ad0f7})
### Parametry

`(string/array)` ID hostów, dla których mają zostać zwrócone skrypty.

[comment]: # ({/080ad0f7-080ad0f7})

[comment]: # ({1c891d1a-1c891d1a})
### Zwracane wartości

`(object)` Zwraca obiekt z identyfikatorami hostów jako właściwościami i tablicami 
dostępnych skryptów jako wartościami.

::: notetip
Metoda automatycznie rozwija makra w tekście 
`confirmation`.
:::

[comment]: # ({/1c891d1a-1c891d1a})

[comment]: # ({b41637d2-b41637d2})
### Przykłady

[comment]: # ({/b41637d2-b41637d2})

[comment]: # ({78b8a18a-4b630539})
#### Pobierz skrypty według identyfikatorów hostów

Pobierz wszystkie skrypty dostępne na hostach "30079" i "30073".

Zapytanie:

```json
{
    "jsonrpc": "2.0",
    "method": "script.getscriptsbyhosts",
    "params": [
        "30079",
        "30073"
    ],
    "auth": "038e1d7b1735c6a5436ee9eae095879e",
    "id": 1
}
```

Odpowiedź:

```json
{
    "jsonrpc": "2.0",
    "result": {
        "30079": [
            {
                "scriptid": "3",
                "name": "Detect operating system",
                "command": "sudo /usr/bin/nmap -O {HOST.CONN} 2>&1",
                "host_access": "2",
                "usrgrpid": "7",
                "groupid": "0",
                "description": "",
                "confirmation": "",
                "type": "0",
                "execute_on": "1",
                "hostid": "10001"
            },
            {
                "scriptid": "1",
                "name": "Ping",
                "command": "/bin/ping -c 3 {HOST.CONN} 2>&1",
                "host_access": "2",
                "usrgrpid": "0",
                "groupid": "0",
                "description": "",
                "confirmation": "",
                "type": "0",
                "execute_on": "1",
                "hostid": "10001"
            },
            {
                "scriptid": "2",
                "name": "Traceroute",
                "command": "/usr/bin/traceroute {HOST.CONN} 2>&1",
                "host_access": "2",
                "usrgrpid": "0",
                "groupid": "0",
                "description": "",
                "confirmation": "",
                "type": "0",
                "execute_on": "1",
                "hostid": "10001"
            }
        ],
        "30073": [
            {
                "scriptid": "3",
                "name": "Detect operating system",
                "command": "sudo /usr/bin/nmap -O {HOST.CONN} 2>&1",
                "host_access": "2",
                "usrgrpid": "7",
                "groupid": "0",
                "description": "",
                "confirmation": "",
                "type": "0",
                "execute_on": "1",
                "hostid": "10001"
            },
            {
                "scriptid": "1",
                "name": "Ping",
                "command": "/bin/ping -c 3 {HOST.CONN} 2>&1",
                "host_access": "2",
                "usrgrpid": "0",
                "groupid": "0",
                "description": "",
                "confirmation": "",
                "type": "0",
                "execute_on": "1",
                "hostid": "10001"
            },
            {
                "scriptid": "2",
                "name": "Traceroute",
                "command": "/usr/bin/traceroute {HOST.CONN} 2>&1",
                "host_access": "2",
                "usrgrpid": "0",
                "groupid": "0",
                "description": "",
                "confirmation": "",
                "type": "0",
                "execute_on": "1",
                "hostid": "10001"
            }
        ]
    },
    "id": 1
}
```

[comment]: # ({/78b8a18a-4b630539})

[comment]: # ({a62657e4-a62657e4})
### Źródło

CScript::getScriptsByHosts() w
*ui/include/classes/api/services/CScript.php*.

[comment]: # ({/a62657e4-a62657e4})
