Return the IP address each binding resolves to in IIS
up vote
-1
down vote
favorite
I am working on getting a script together that will tell me every binding on a server and what live IPv4 address that binding resolves to. I am very close, but because I am exporting my results from IIS to CSV and then running Test-connection on each binding from that CSV, I'm having trouble adding the results to an array and exporting the finished results to a CSV file. Here is the script:
Import-Module WebAdministration
$hostname = hostname
$Websites = Get-ChildItem IIS:Sites
$date = (Get-Date).ToString('MMddyyyy')
foreach ($Site in $Websites) select-object Value
Do
if( $Bindings[($i)] -notlike "sslFlags=*") Add-member Path $site.physicalPath
$obj
else$i=$i+1
while ($i -lt ($bindings.count))
$CSVvar = import-csv "c:temp$date-$hostname.csv"
$i=0
foreach ($v in $CSVvar)
If ($v.Header -ne '')
$result = Test-Connection $v.Header -ErrorAction SilentlyContinue
if ($result)
$IP = ($result.IPV4Address).IPAddressToString
echo $IP
$v.ResolveAddress = $IP
$CSVvar | export-csv "c:temp$date-$hostname.csv" -Append -notypeinformation
I am thinking it would be best to ping each binding before the CSV file is exported the first time, but I can't figure out a way to get it to try each element of the Header object individually, and I keep crashing the script that way. If I can get the IP address(es) to save back to the $CSVvar.ResolveAddress column, that would be fine by me. Any help is appreciated!
asp.net powershell iis iis-8.5
add a comment |
up vote
-1
down vote
favorite
I am working on getting a script together that will tell me every binding on a server and what live IPv4 address that binding resolves to. I am very close, but because I am exporting my results from IIS to CSV and then running Test-connection on each binding from that CSV, I'm having trouble adding the results to an array and exporting the finished results to a CSV file. Here is the script:
Import-Module WebAdministration
$hostname = hostname
$Websites = Get-ChildItem IIS:Sites
$date = (Get-Date).ToString('MMddyyyy')
foreach ($Site in $Websites) select-object Value
Do
if( $Bindings[($i)] -notlike "sslFlags=*") Add-member Path $site.physicalPath
$obj
else$i=$i+1
while ($i -lt ($bindings.count))
$CSVvar = import-csv "c:temp$date-$hostname.csv"
$i=0
foreach ($v in $CSVvar)
If ($v.Header -ne '')
$result = Test-Connection $v.Header -ErrorAction SilentlyContinue
if ($result)
$IP = ($result.IPV4Address).IPAddressToString
echo $IP
$v.ResolveAddress = $IP
$CSVvar | export-csv "c:temp$date-$hostname.csv" -Append -notypeinformation
I am thinking it would be best to ping each binding before the CSV file is exported the first time, but I can't figure out a way to get it to try each element of the Header object individually, and I keep crashing the script that way. If I can get the IP address(es) to save back to the $CSVvar.ResolveAddress column, that would be fine by me. Any help is appreciated!
asp.net powershell iis iis-8.5
A site binding can have no IP address at all (all unassigned for example). So your script makes many assumptions that you didn’t reveal as part of the question. Unless you edit it to include such, it cannot be answered.
– Lex Li
Nov 11 at 21:54
add a comment |
up vote
-1
down vote
favorite
up vote
-1
down vote
favorite
I am working on getting a script together that will tell me every binding on a server and what live IPv4 address that binding resolves to. I am very close, but because I am exporting my results from IIS to CSV and then running Test-connection on each binding from that CSV, I'm having trouble adding the results to an array and exporting the finished results to a CSV file. Here is the script:
Import-Module WebAdministration
$hostname = hostname
$Websites = Get-ChildItem IIS:Sites
$date = (Get-Date).ToString('MMddyyyy')
foreach ($Site in $Websites) select-object Value
Do
if( $Bindings[($i)] -notlike "sslFlags=*") Add-member Path $site.physicalPath
$obj
else$i=$i+1
while ($i -lt ($bindings.count))
$CSVvar = import-csv "c:temp$date-$hostname.csv"
$i=0
foreach ($v in $CSVvar)
If ($v.Header -ne '')
$result = Test-Connection $v.Header -ErrorAction SilentlyContinue
if ($result)
$IP = ($result.IPV4Address).IPAddressToString
echo $IP
$v.ResolveAddress = $IP
$CSVvar | export-csv "c:temp$date-$hostname.csv" -Append -notypeinformation
I am thinking it would be best to ping each binding before the CSV file is exported the first time, but I can't figure out a way to get it to try each element of the Header object individually, and I keep crashing the script that way. If I can get the IP address(es) to save back to the $CSVvar.ResolveAddress column, that would be fine by me. Any help is appreciated!
asp.net powershell iis iis-8.5
I am working on getting a script together that will tell me every binding on a server and what live IPv4 address that binding resolves to. I am very close, but because I am exporting my results from IIS to CSV and then running Test-connection on each binding from that CSV, I'm having trouble adding the results to an array and exporting the finished results to a CSV file. Here is the script:
Import-Module WebAdministration
$hostname = hostname
$Websites = Get-ChildItem IIS:Sites
$date = (Get-Date).ToString('MMddyyyy')
foreach ($Site in $Websites) select-object Value
Do
if( $Bindings[($i)] -notlike "sslFlags=*") Add-member Path $site.physicalPath
$obj
else$i=$i+1
while ($i -lt ($bindings.count))
$CSVvar = import-csv "c:temp$date-$hostname.csv"
$i=0
foreach ($v in $CSVvar)
If ($v.Header -ne '')
$result = Test-Connection $v.Header -ErrorAction SilentlyContinue
if ($result)
$IP = ($result.IPV4Address).IPAddressToString
echo $IP
$v.ResolveAddress = $IP
$CSVvar | export-csv "c:temp$date-$hostname.csv" -Append -notypeinformation
I am thinking it would be best to ping each binding before the CSV file is exported the first time, but I can't figure out a way to get it to try each element of the Header object individually, and I keep crashing the script that way. If I can get the IP address(es) to save back to the $CSVvar.ResolveAddress column, that would be fine by me. Any help is appreciated!
asp.net powershell iis iis-8.5
asp.net powershell iis iis-8.5
asked Nov 11 at 21:11
DeltaMike
216
216
A site binding can have no IP address at all (all unassigned for example). So your script makes many assumptions that you didn’t reveal as part of the question. Unless you edit it to include such, it cannot be answered.
– Lex Li
Nov 11 at 21:54
add a comment |
A site binding can have no IP address at all (all unassigned for example). So your script makes many assumptions that you didn’t reveal as part of the question. Unless you edit it to include such, it cannot be answered.
– Lex Li
Nov 11 at 21:54
A site binding can have no IP address at all (all unassigned for example). So your script makes many assumptions that you didn’t reveal as part of the question. Unless you edit it to include such, it cannot be answered.
– Lex Li
Nov 11 at 21:54
A site binding can have no IP address at all (all unassigned for example). So your script makes many assumptions that you didn’t reveal as part of the question. Unless you edit it to include such, it cannot be answered.
– Lex Li
Nov 11 at 21:54
add a comment |
1 Answer
1
active
oldest
votes
up vote
0
down vote
That seems like a lot of code, just to do this. How about this approach.
### Get website info
Import-Module -Name WebAdministration
Get-Website | select name,id,state,physicalpath,
@n="Host"; e= $env:COMPUTERNAME ,
@n="Bindings"; e= select -expa collection) -join ';' ,
@n="LogFile";e= select -expa directory,
@n="attributes"; e=($_.attributes ,
@n="ConnectionTest"; e=:')[1] -Count 1 -Quiet) |
Export-Csv -NoTypeInformation -Path 'C:tempmy_list.csv'
Import-Csv -Path 'C:tempmy_list.csv'
# Results
name : Default Web Site
id : 1
state : Started
physicalPath : %SystemDrive%inetpubwwwroot
Host : IIS01
Bindings : http *:80:;https *:443: sslFlags=0
LogFile : %SystemDrive%inetpublogsLogFiles
attributes : name=Default Web Site;id=1;serverAutoStart=True;state=1
ConnectionTest : True
name : kcd
id : 2
state : Started
physicalPath : C:inetpubkcd
Host : IIS01
Bindings : http 192.168.7.11:80:kcd.contoso.com
LogFile : %SystemDrive%inetpublogsLogFiles
attributes : name=kcd;id=2;serverAutoStart=True;state=1
ConnectionTest : True
Of course one could break out / cherry pick all the other collected pieces / info into separate calculated properties as needed.
Update for OP
... but really all I'm having trouble with is getting the IPv4 info from
the ConnectionTest response appended to the original document ...
Just use the same code I used for the Test-Connection.
Import-Module -Name WebAdministration
Get-Website | select name,id,state,physicalpath,
@n="Host"; e= $env:COMPUTERNAME ,
@n="Bindings"; e= select -expa collection) -join ';' ,
@n="LogFile";e= select -expa directory,
@n="attributes"; e=($_.attributes ,
@n="ConnectionTest"; e=:')[1] -Count 1 -Quiet),
@n="SiteIPA"; e=($Bindings -split 'http
Thanks, and yes your method does look more elegant. Perhaps I gave too much context, but really all I'm having trouble with is getting the IPv4 info from the ConnectionTest response appended to the original document the corresponding binding came from, a la:#foo.csv google.com
Code Executes...$CSVvar | export-csv -Path 'bar.csv' -Append -notypeinformation import-csv -Path 'bar.csv' #Results Name: google.com IPv4: 172.217.15.110
– DeltaMike
Nov 13 at 14:55
But the IPA associated with the binding is in the bindings field. Why would you want to try and get it again from the Test-Connection results? You can just pull that from the bindings field as I did for that Test-Connection call. See my update for you.
– postanote
Nov 14 at 23:20
Because this is a maintenance script, helping to determine sites that do not in actuality have their domain pointed to this server any longer, so that the site can be removed. It doesn't really matter what I want to do with it though, What I need is the IP address that the binding actually resolves to. If it's a match for what is in IIS, awesome. If it is not, the site can be booted. Interrogating as to the why is not helpful. My question is clear, and the solution is still not.
– DeltaMike
Nov 16 at 23:12
add a comment |
Your Answer
StackExchange.ifUsing("editor", function ()
StackExchange.using("externalEditor", function ()
StackExchange.using("snippets", function ()
StackExchange.snippets.init();
);
);
, "code-snippets");
StackExchange.ready(function()
var channelOptions =
tags: "".split(" "),
id: "1"
;
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function()
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled)
StackExchange.using("snippets", function()
createEditor();
);
else
createEditor();
);
function createEditor()
StackExchange.prepareEditor(
heartbeatType: 'answer',
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader:
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
,
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
);
);
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53253274%2freturn-the-ip-address-each-binding-resolves-to-in-iis%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
1 Answer
1
active
oldest
votes
1 Answer
1
active
oldest
votes
active
oldest
votes
active
oldest
votes
up vote
0
down vote
That seems like a lot of code, just to do this. How about this approach.
### Get website info
Import-Module -Name WebAdministration
Get-Website | select name,id,state,physicalpath,
@n="Host"; e= $env:COMPUTERNAME ,
@n="Bindings"; e= select -expa collection) -join ';' ,
@n="LogFile";e= select -expa directory,
@n="attributes"; e=($_.attributes ,
@n="ConnectionTest"; e=:')[1] -Count 1 -Quiet) |
Export-Csv -NoTypeInformation -Path 'C:tempmy_list.csv'
Import-Csv -Path 'C:tempmy_list.csv'
# Results
name : Default Web Site
id : 1
state : Started
physicalPath : %SystemDrive%inetpubwwwroot
Host : IIS01
Bindings : http *:80:;https *:443: sslFlags=0
LogFile : %SystemDrive%inetpublogsLogFiles
attributes : name=Default Web Site;id=1;serverAutoStart=True;state=1
ConnectionTest : True
name : kcd
id : 2
state : Started
physicalPath : C:inetpubkcd
Host : IIS01
Bindings : http 192.168.7.11:80:kcd.contoso.com
LogFile : %SystemDrive%inetpublogsLogFiles
attributes : name=kcd;id=2;serverAutoStart=True;state=1
ConnectionTest : True
Of course one could break out / cherry pick all the other collected pieces / info into separate calculated properties as needed.
Update for OP
... but really all I'm having trouble with is getting the IPv4 info from
the ConnectionTest response appended to the original document ...
Just use the same code I used for the Test-Connection.
Import-Module -Name WebAdministration
Get-Website | select name,id,state,physicalpath,
@n="Host"; e= $env:COMPUTERNAME ,
@n="Bindings"; e= select -expa collection) -join ';' ,
@n="LogFile";e= select -expa directory,
@n="attributes"; e=($_.attributes ,
@n="ConnectionTest"; e=:')[1] -Count 1 -Quiet),
@n="SiteIPA"; e=($Bindings -split 'http
Thanks, and yes your method does look more elegant. Perhaps I gave too much context, but really all I'm having trouble with is getting the IPv4 info from the ConnectionTest response appended to the original document the corresponding binding came from, a la:#foo.csv google.com
Code Executes...$CSVvar | export-csv -Path 'bar.csv' -Append -notypeinformation import-csv -Path 'bar.csv' #Results Name: google.com IPv4: 172.217.15.110
– DeltaMike
Nov 13 at 14:55
But the IPA associated with the binding is in the bindings field. Why would you want to try and get it again from the Test-Connection results? You can just pull that from the bindings field as I did for that Test-Connection call. See my update for you.
– postanote
Nov 14 at 23:20
Because this is a maintenance script, helping to determine sites that do not in actuality have their domain pointed to this server any longer, so that the site can be removed. It doesn't really matter what I want to do with it though, What I need is the IP address that the binding actually resolves to. If it's a match for what is in IIS, awesome. If it is not, the site can be booted. Interrogating as to the why is not helpful. My question is clear, and the solution is still not.
– DeltaMike
Nov 16 at 23:12
add a comment |
up vote
0
down vote
That seems like a lot of code, just to do this. How about this approach.
### Get website info
Import-Module -Name WebAdministration
Get-Website | select name,id,state,physicalpath,
@n="Host"; e= $env:COMPUTERNAME ,
@n="Bindings"; e= select -expa collection) -join ';' ,
@n="LogFile";e= select -expa directory,
@n="attributes"; e=($_.attributes ,
@n="ConnectionTest"; e=:')[1] -Count 1 -Quiet) |
Export-Csv -NoTypeInformation -Path 'C:tempmy_list.csv'
Import-Csv -Path 'C:tempmy_list.csv'
# Results
name : Default Web Site
id : 1
state : Started
physicalPath : %SystemDrive%inetpubwwwroot
Host : IIS01
Bindings : http *:80:;https *:443: sslFlags=0
LogFile : %SystemDrive%inetpublogsLogFiles
attributes : name=Default Web Site;id=1;serverAutoStart=True;state=1
ConnectionTest : True
name : kcd
id : 2
state : Started
physicalPath : C:inetpubkcd
Host : IIS01
Bindings : http 192.168.7.11:80:kcd.contoso.com
LogFile : %SystemDrive%inetpublogsLogFiles
attributes : name=kcd;id=2;serverAutoStart=True;state=1
ConnectionTest : True
Of course one could break out / cherry pick all the other collected pieces / info into separate calculated properties as needed.
Update for OP
... but really all I'm having trouble with is getting the IPv4 info from
the ConnectionTest response appended to the original document ...
Just use the same code I used for the Test-Connection.
Import-Module -Name WebAdministration
Get-Website | select name,id,state,physicalpath,
@n="Host"; e= $env:COMPUTERNAME ,
@n="Bindings"; e= select -expa collection) -join ';' ,
@n="LogFile";e= select -expa directory,
@n="attributes"; e=($_.attributes ,
@n="ConnectionTest"; e=:')[1] -Count 1 -Quiet),
@n="SiteIPA"; e=($Bindings -split 'http
Thanks, and yes your method does look more elegant. Perhaps I gave too much context, but really all I'm having trouble with is getting the IPv4 info from the ConnectionTest response appended to the original document the corresponding binding came from, a la:#foo.csv google.com
Code Executes...$CSVvar | export-csv -Path 'bar.csv' -Append -notypeinformation import-csv -Path 'bar.csv' #Results Name: google.com IPv4: 172.217.15.110
– DeltaMike
Nov 13 at 14:55
But the IPA associated with the binding is in the bindings field. Why would you want to try and get it again from the Test-Connection results? You can just pull that from the bindings field as I did for that Test-Connection call. See my update for you.
– postanote
Nov 14 at 23:20
Because this is a maintenance script, helping to determine sites that do not in actuality have their domain pointed to this server any longer, so that the site can be removed. It doesn't really matter what I want to do with it though, What I need is the IP address that the binding actually resolves to. If it's a match for what is in IIS, awesome. If it is not, the site can be booted. Interrogating as to the why is not helpful. My question is clear, and the solution is still not.
– DeltaMike
Nov 16 at 23:12
add a comment |
up vote
0
down vote
up vote
0
down vote
That seems like a lot of code, just to do this. How about this approach.
### Get website info
Import-Module -Name WebAdministration
Get-Website | select name,id,state,physicalpath,
@n="Host"; e= $env:COMPUTERNAME ,
@n="Bindings"; e= select -expa collection) -join ';' ,
@n="LogFile";e= select -expa directory,
@n="attributes"; e=($_.attributes ,
@n="ConnectionTest"; e=:')[1] -Count 1 -Quiet) |
Export-Csv -NoTypeInformation -Path 'C:tempmy_list.csv'
Import-Csv -Path 'C:tempmy_list.csv'
# Results
name : Default Web Site
id : 1
state : Started
physicalPath : %SystemDrive%inetpubwwwroot
Host : IIS01
Bindings : http *:80:;https *:443: sslFlags=0
LogFile : %SystemDrive%inetpublogsLogFiles
attributes : name=Default Web Site;id=1;serverAutoStart=True;state=1
ConnectionTest : True
name : kcd
id : 2
state : Started
physicalPath : C:inetpubkcd
Host : IIS01
Bindings : http 192.168.7.11:80:kcd.contoso.com
LogFile : %SystemDrive%inetpublogsLogFiles
attributes : name=kcd;id=2;serverAutoStart=True;state=1
ConnectionTest : True
Of course one could break out / cherry pick all the other collected pieces / info into separate calculated properties as needed.
Update for OP
... but really all I'm having trouble with is getting the IPv4 info from
the ConnectionTest response appended to the original document ...
Just use the same code I used for the Test-Connection.
Import-Module -Name WebAdministration
Get-Website | select name,id,state,physicalpath,
@n="Host"; e= $env:COMPUTERNAME ,
@n="Bindings"; e= select -expa collection) -join ';' ,
@n="LogFile";e= select -expa directory,
@n="attributes"; e=($_.attributes ,
@n="ConnectionTest"; e=:')[1] -Count 1 -Quiet),
@n="SiteIPA"; e=($Bindings -split 'http
That seems like a lot of code, just to do this. How about this approach.
### Get website info
Import-Module -Name WebAdministration
Get-Website | select name,id,state,physicalpath,
@n="Host"; e= $env:COMPUTERNAME ,
@n="Bindings"; e= select -expa collection) -join ';' ,
@n="LogFile";e= select -expa directory,
@n="attributes"; e=($_.attributes ,
@n="ConnectionTest"; e=:')[1] -Count 1 -Quiet) |
Export-Csv -NoTypeInformation -Path 'C:tempmy_list.csv'
Import-Csv -Path 'C:tempmy_list.csv'
# Results
name : Default Web Site
id : 1
state : Started
physicalPath : %SystemDrive%inetpubwwwroot
Host : IIS01
Bindings : http *:80:;https *:443: sslFlags=0
LogFile : %SystemDrive%inetpublogsLogFiles
attributes : name=Default Web Site;id=1;serverAutoStart=True;state=1
ConnectionTest : True
name : kcd
id : 2
state : Started
physicalPath : C:inetpubkcd
Host : IIS01
Bindings : http 192.168.7.11:80:kcd.contoso.com
LogFile : %SystemDrive%inetpublogsLogFiles
attributes : name=kcd;id=2;serverAutoStart=True;state=1
ConnectionTest : True
Of course one could break out / cherry pick all the other collected pieces / info into separate calculated properties as needed.
Update for OP
... but really all I'm having trouble with is getting the IPv4 info from
the ConnectionTest response appended to the original document ...
Just use the same code I used for the Test-Connection.
Import-Module -Name WebAdministration
Get-Website | select name,id,state,physicalpath,
@n="Host"; e= $env:COMPUTERNAME ,
@n="Bindings"; e= select -expa collection) -join ';' ,
@n="LogFile";e= select -expa directory,
@n="attributes"; e=($_.attributes ,
@n="ConnectionTest"; e=:')[1] -Count 1 -Quiet),
@n="SiteIPA"; e=($Bindings -split 'http
edited Nov 14 at 23:24
answered Nov 11 at 22:41
postanote
2,9581310
2,9581310
Thanks, and yes your method does look more elegant. Perhaps I gave too much context, but really all I'm having trouble with is getting the IPv4 info from the ConnectionTest response appended to the original document the corresponding binding came from, a la:#foo.csv google.com
Code Executes...$CSVvar | export-csv -Path 'bar.csv' -Append -notypeinformation import-csv -Path 'bar.csv' #Results Name: google.com IPv4: 172.217.15.110
– DeltaMike
Nov 13 at 14:55
But the IPA associated with the binding is in the bindings field. Why would you want to try and get it again from the Test-Connection results? You can just pull that from the bindings field as I did for that Test-Connection call. See my update for you.
– postanote
Nov 14 at 23:20
Because this is a maintenance script, helping to determine sites that do not in actuality have their domain pointed to this server any longer, so that the site can be removed. It doesn't really matter what I want to do with it though, What I need is the IP address that the binding actually resolves to. If it's a match for what is in IIS, awesome. If it is not, the site can be booted. Interrogating as to the why is not helpful. My question is clear, and the solution is still not.
– DeltaMike
Nov 16 at 23:12
add a comment |
Thanks, and yes your method does look more elegant. Perhaps I gave too much context, but really all I'm having trouble with is getting the IPv4 info from the ConnectionTest response appended to the original document the corresponding binding came from, a la:#foo.csv google.com
Code Executes...$CSVvar | export-csv -Path 'bar.csv' -Append -notypeinformation import-csv -Path 'bar.csv' #Results Name: google.com IPv4: 172.217.15.110
– DeltaMike
Nov 13 at 14:55
But the IPA associated with the binding is in the bindings field. Why would you want to try and get it again from the Test-Connection results? You can just pull that from the bindings field as I did for that Test-Connection call. See my update for you.
– postanote
Nov 14 at 23:20
Because this is a maintenance script, helping to determine sites that do not in actuality have their domain pointed to this server any longer, so that the site can be removed. It doesn't really matter what I want to do with it though, What I need is the IP address that the binding actually resolves to. If it's a match for what is in IIS, awesome. If it is not, the site can be booted. Interrogating as to the why is not helpful. My question is clear, and the solution is still not.
– DeltaMike
Nov 16 at 23:12
Thanks, and yes your method does look more elegant. Perhaps I gave too much context, but really all I'm having trouble with is getting the IPv4 info from the ConnectionTest response appended to the original document the corresponding binding came from, a la:
#foo.csv google.com
Code Executes... $CSVvar | export-csv -Path 'bar.csv' -Append -notypeinformation import-csv -Path 'bar.csv' #Results Name: google.com IPv4: 172.217.15.110
– DeltaMike
Nov 13 at 14:55
Thanks, and yes your method does look more elegant. Perhaps I gave too much context, but really all I'm having trouble with is getting the IPv4 info from the ConnectionTest response appended to the original document the corresponding binding came from, a la:
#foo.csv google.com
Code Executes... $CSVvar | export-csv -Path 'bar.csv' -Append -notypeinformation import-csv -Path 'bar.csv' #Results Name: google.com IPv4: 172.217.15.110
– DeltaMike
Nov 13 at 14:55
But the IPA associated with the binding is in the bindings field. Why would you want to try and get it again from the Test-Connection results? You can just pull that from the bindings field as I did for that Test-Connection call. See my update for you.
– postanote
Nov 14 at 23:20
But the IPA associated with the binding is in the bindings field. Why would you want to try and get it again from the Test-Connection results? You can just pull that from the bindings field as I did for that Test-Connection call. See my update for you.
– postanote
Nov 14 at 23:20
Because this is a maintenance script, helping to determine sites that do not in actuality have their domain pointed to this server any longer, so that the site can be removed. It doesn't really matter what I want to do with it though, What I need is the IP address that the binding actually resolves to. If it's a match for what is in IIS, awesome. If it is not, the site can be booted. Interrogating as to the why is not helpful. My question is clear, and the solution is still not.
– DeltaMike
Nov 16 at 23:12
Because this is a maintenance script, helping to determine sites that do not in actuality have their domain pointed to this server any longer, so that the site can be removed. It doesn't really matter what I want to do with it though, What I need is the IP address that the binding actually resolves to. If it's a match for what is in IIS, awesome. If it is not, the site can be booted. Interrogating as to the why is not helpful. My question is clear, and the solution is still not.
– DeltaMike
Nov 16 at 23:12
add a comment |
Thanks for contributing an answer to Stack Overflow!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Some of your past answers have not been well-received, and you're in danger of being blocked from answering.
Please pay close attention to the following guidance:
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53253274%2freturn-the-ip-address-each-binding-resolves-to-in-iis%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
A site binding can have no IP address at all (all unassigned for example). So your script makes many assumptions that you didn’t reveal as part of the question. Unless you edit it to include such, it cannot be answered.
– Lex Li
Nov 11 at 21:54