Script from 2 csv - URL list and Folder list

%3CLINGO-SUB%20id%3D%22lingo-sub-2595331%22%20slang%3D%22en-US%22%3EScript%20from%202%20csv%20-%20URL%20list%20and%20Folder%20list%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-2595331%22%20slang%3D%22en-US%22%3E%3CP%3EHello%20there!%3C%2FP%3E%3CP%3EI%20have%202%20csv%20files.%26nbsp%3B%3C%2FP%3E%3CP%3Eone%20has%2082%20rows%20with%20unique%20site%20address.%20like%20below%3C%2FP%3E%3CP%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%20lia-image-align-inline%22%20image-alt%3D%22rjack_1-1627582314611.png%22%20style%3D%22width%3A%20400px%3B%22%3E%3CIMG%20src%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F299248i3047802317C2511F%2Fimage-size%2Fmedium%3Fv%3Dv2%26amp%3Bpx%3D400%22%20role%3D%22button%22%20title%3D%22rjack_1-1627582314611.png%22%20alt%3D%22rjack_1-1627582314611.png%22%20%2F%3E%3C%2FSPAN%3E%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3Ethe%20other%20has%201314ish%20folder%20names%20with%20path.%20like%20below%3C%2FP%3E%3CP%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%20lia-image-align-inline%22%20image-alt%3D%22rjack_0-1627582174643.png%22%20style%3D%22width%3A%20400px%3B%22%3E%3CIMG%20src%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F299247i05B4EF3C07283441%2Fimage-size%2Fmedium%3Fv%3Dv2%26amp%3Bpx%3D400%22%20role%3D%22button%22%20title%3D%22rjack_0-1627582174643.png%22%20alt%3D%22rjack_0-1627582174643.png%22%20%2F%3E%3C%2FSPAN%3E%3C%2FP%3E%3CP%3EPreviously%2C%20I%20used%20to%20create%201000s%20of%20folder%20per%20site%20per%20script%20and%20now%20I%20have%20to%20create%20the%20same%20set%20of%20folders%20on%2082%20sites.%20so%20was%20trying%20to%20improvise%20the%20script%20by%20importing%20a%20csv%20and%20added%20'for%20each'.%20the%20script%20works%20but%20skips%20all%20sites%20and%20goes%20to%20the%20last%20site%20in%20the%20list%20and%20creates%20the%201314%20folders%20with%20correct%20permission.%26nbsp%3B%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3Ebelow%20is%20what%20I%20added%20to%20the%20script%20trying%20to%20trigger%20the%20loop.%26nbsp%3B%20Please%20help!%3C%2FP%3E%3CP%3EWould%20you%20need%20the%20full%20script%3F%20let%20me%20know%2C%20its%20107%20lines%20though.%20%3A)%3C%2Fimg%3E%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CPRE%20class%3D%22lia-code-sample%20language-applescript%22%3E%3CCODE%3E%24csvs%3D%20Import-CSV%20%24csvfilepathsite%0Aforeach%20(%24row%20in%20%24csvs)%0A%7B%0A%24url%20%3D%20%24row.siteurl%0A%24GroupNames%3D%24row.GroupNames%3C%2FCODE%3E%3C%2FPRE%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-LABS%20id%3D%22lingo-labs-2595331%22%20slang%3D%22en-US%22%3E%3CLINGO-LABEL%3EPowerShell%3C%2FLINGO-LABEL%3E%3CLINGO-LABEL%3EScript%3C%2FLINGO-LABEL%3E%3CLINGO-LABEL%3ESharePoint%3C%2FLINGO-LABEL%3E%3C%2FLINGO-LABS%3E
Occasional Contributor

Hello there!

I have 2 csv files. 

one has 82 rows with unique site address. like below

rjack_1-1627582314611.png

 

the other has 1314ish folder names with path. like below

rjack_0-1627582174643.png

Previously, I used to create 1000s of folder per site per script and now I have to create the same set of folders on 82 sites. so was trying to improvise the script by importing a csv and added 'for each'. the script works but skips all sites and goes to the last site in the list and creates the 1314 folders with correct permission. 

 

below is what I added to the script trying to trigger the loop.  Please help!

Would you need the full script? let me know, its 107 lines though. :)

 

 

$csvs= Import-CSV $csvfilepathsite
foreach ($row in $csvs)
{
$url = $row.siteurl
$GroupNames=$row.GroupNames

 

 

1 Reply

This is now solved. Later, posted the same in Poweshell forum and added the whole script, should've dont that here in the first place. 

 

link to resolution if any one needed it!: https://techcommunity.microsoft.com/t5/windows-powershell/script-from-2-csv-url-list-and-folder-list...