簡體   English   中英

僅過濾 Exchange 服務 ip

[英]Filter only Exchange service ips

遇到一個問題,我想過濾並僅使用專門與 Exchange online 相關的 IP,而不使用其他任何東西。

我可以輕松獲取所有服務的所有 IP,但目標是只獲取 Exchange 在線服務的 IP。 我嘗試了 select-object 和 where-object 的變體但沒有成功

這就是我的工作......我已經放棄了對代碼的嘗試,因為它們從未返回任何值

$o365Uri = "https://endpoints.office.com/endpoints/worldwide?clientrequestid=b10c5ed1-bad1-445f-b386-b919946339a7"
$iplist = Invoke-RestMethod $o365Uri
$iplist

如果我只想要所有的 ips...

$iplist.ips

我只想要serviceArea = Exchange的特定位置的 $iplist.ips。 也可以使用 URL 代替 ips。 要么工作。

弄清楚了。 這僅返回交換服務的 IP

# Call the O365 API to get the IP addresses
$uri = "https://endpoints.office.com/endpoints/worldwide?clientrequestid=b10c5ed1-bad1-445f-b386-b919946339a7"
$call = Invoke-RestMethod $uri

$exchange = $call | where {$_.serviceArea -eq "Exchange"}
$exchangeUrls = $exchange.urls

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM