Quantcast
Channel: Windows PowerShell forum
Viewing all articles
Browse latest Browse all 21975

Using an array item as a parameter in a path.

$
0
0

So I have an array that includes a name, folder, and port that I'm using to create IIS website.

E.g. $site = "www.test.com","test",1234)

I'm then trying to use the new-website command as follows:

New-Website -Name $site[0] -ApplicationPool $site[0] -IPAddress 1.2.3.4 -PhysicalPath "d:\sites\$site[1]" -Port $site[2]

I thought that variables inside of quotes still got turned into their values but the PHysicalPath part isn't working.  I want the path to be D:\sites\test where it pulls "test" from the middle of the array variable.  I'm getting an error that the path doesn't exist.

What am I missing here?

Thanks.


Viewing all articles
Browse latest Browse all 21975

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>