This should be fairly easy and i did similar with test connection. I have a list of home drives, that were established in AD.
90% have this set but the folders do not exist.
I used
$Test = get-content C:\Test\Test.txt
$test | test-path returns true fals value but not the path tested.
I attempted to create them but multiple attempts later i am getting impatient.
If (!(Test-path $Test)) {new-item -type directory -path $test # I have tried variations of $item $items foreach-object and so on.
I am unable to figure this out.
I would like to do the test-path and return a list of paths that fail then from that list create the new Folder. I would also like to know if and how i could do this in one step rather than two.
Thank you