Quantcast
Channel: PowerShell.com – PowerShell Scripts, Tips, Forums, and Resources
Viewing all articles
Browse latest Browse all 6937

loop through numbered variables.

$
0
0

I know this probably a dumb question, but I have been working on it for an hour and can't figure it out.

 

I have numbered variables.

$value.IPAddress0

$value.IPAddress1

$value.IPAddress3

$value.IPAddress4

ETC.

 

I need to loop through all of the $value.IPAddress(x) variables starting with 0

 

$k=0

$j=0

While ($k -ne $a){

if ($value.IPAddress+$k -ne ""){

write-host $value.IPAddress$k

$j++

}

$k++

}

 

 


Viewing all articles
Browse latest Browse all 6937

Trending Articles