Anyone Able to Help Out a PS Newbie?

Hi all,

Looking for some assistance please.

I am attempting to use PS to import a list of IP address subnets (with individual, corresponding, site names) from CSV and for each of them, create additional items and then export the result to another CSV.

In the import CSV there are two columns, “Site Name” and “IP Address” e.g.

Site Name IP Address
I'd like to use PS to ultimately output a separate (one column) CSV containing something along the lines of the following:
ConnectionName; ConnectionAddress; FolderName
Test1 Host1;; Test1 Host1
Test1 Host2;; Test1 Host2
Test1 Host3;; Test1 Host3
Test2 Host1;; Test2 Host1
Test2 Host2;; Test2 Host2
Test2 Host3;; Test2 Host3
Test3 Host1;; Test3 Host1
Test3 Host2;; Test3 Host2
Test3 Host3;; Test3 Host3
The idea being that the output CSV can be read by a system in order to create a hierarchy.

I’m aware (roughly) I’m looking at using “import-csv”, “foreach” and, I’m assuming, “new-item” but I’m not entirely sure how to put it all together.

If anyone could point me in the right direction I’d appreciate it.



Import-Csv c:\temp\subnets.csv | ForEach-Object {
  for ($x=1; $x -lt 4; $x++) {
    $subnet = $_.'IP Address'.Substring(0,$_.'IP Address'.Length-1)
    $_.'Site Name' + " Host$x;$subnet$x;" + $_.'Site Name' + " Host$x"

Hi Seam,

Thanks for taking the time to reply. Very helpful of you. Much appreciated.