alphasec academy

Get-NetIPAddress -AddressState Preferred|select IPAddress,InterfaceAlias - wyświetl aktywne interfejsy sieciowe i ich IP

Dodatkowe informacje

Ten oneliner warto mieć w worku onelinerów rekonesansowych. Istotnym jest tutaj AddressState, którego wartość Preferred oznacza, że adres IP jest prawidłowy i gotowy do użycia. Wszystkie możliwe wartości, za dokumentacją:
-- 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.

Ciekawostka

Jeśli planujecie to na danym komputerze wykorzystywać często, a ten oneliner jest za długi, można go sobie wrzucić w funkcję, np.:
function ip { Get-NetIPAddress -AddressState Preferred|select IPAddress,InterfaceAlias } 
Po czym wystarczy ją uruchomić, pisząc po prostu:
ip
    
Funkcje nierzadko mogą ułatwić życie

Przydatne linki


Subskrybuj

Jeśli chcesz otrzymywać nowe, mięsiste protipy na maila, a także zostać czasem powiadomiony o wartościowych wydarzeniach - dołącz do subskrybentów.