Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #Create new webclient object
- $WebClient = New-Object System.Net.WebClient
- #Enable integrated authentication
- $WebClient.UseDefaultCredentials = $true
- #Get the json objects
- $Virtualservers = ($WebClient.DownloadString("http://loadbalancing.se/bigipreportdemo/json/virtualservers.json")) | ConvertFrom-Json
- $pools = ($WebClient.DownloadString("http://loadbalancing.se/bigipreportdemo/json/pools.json")) | ConvertFrom-Json
- #Get the pools that contains "/Common/worker01.int.local"
- $Poolselection = $($pools | Where-Object { $_.members.name -contains "/Common/worker01.int.local" }).name
- #Loop through the virtual servers
- Foreach($vs in $VirtualServers){
- foreach($Pool in $vs.Pools){
- if($Poolselection -Contains $Pool){
- #We found a match, print out the $vs
- $vs
- #If more than one pool is matched on this vs we don't want to print it twice, so we exit the inner loop
- Break
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement