I needed to create directories for every "id" in a dynamic CSV from a webserver.
This required me to need to convert the CSV to a object then foreach through that object checking for the directory and creating it if it was not there.
foreach ($loc in ((Invoke-WebRequest -URI https://my.webserver.address/get_csv.php).Content |
ConvertFrom-Csv -Delimiter ",")) {
$path = ('C:\Shares\Pages\'+$loc.id);
if (!(test-path -PathType Container $path)){
New-Item -ItemType Directory -Path $path
}
}