hello guys i'm a beginner in powershell , i have an outpout file from a script that i createdto check all volume data (datax) on a netapp SVM(na0maa-euc01) level3 folder who have everyone permission on it and without active directory security groups(must positionned on the level3 folders) , so the outpout txt file is like that
\\na0maa-euc01\data1\Nissan Production Engineering\TC Facility\X11M
\\na0maa-euc01\data1\Powertrain_DIP-A entry\IQMS\Data
\\na0maa-euc01\data1\Powertrain_DIP-A entry\PROJECT INFORMATION\Data
\\na0maa-euc01\data2\powertrain_emb_ice_algorithm_OLD\Data\05_DCM
those level 3 folder where copied from a 7 mode netapp named f-typhon-old were the acl are ok
\\f-typhon-old\data1\Nissan Production Engineering.mig\TC Facility\X11M
\\f-typhon-old\data1\Powertrain_DIP-A entry.mig\IQMS\Data
\\f-typhon-old\data1\Powertrain_DIP-A entry.mig\PROJECT INFORMATION\Data
\\f-typhon-old\data2\powertrain_emb_ice_algorithm_OLD.mig\Data\05_DCM
so i created a new file with a baseline to correct the acl like that
data1\Nissan Production Engineering\TC Facility\X11M
data1\Powertrain_DIP-A entry\IQMS\Data
data1\Powertrain_DIP-A entry\PROJECT INFORMATION\Data
data2\powertrain_emb_ice_algorithm_OLD.mig\Data\05_DCM
made a little script with a loop on the file with get-acl and set-acl to correct but the issue is i need a text manipulation to create a variable $level3old to store in it the path with .mig in the level1 folders i don't now how to do it or if it was possible in powershell
$Pth = "C:\temp\mig\mig_CDOT\0INCHE\Log\Robocopy\Extract\acl_user"
$filerd = "na0maa-euc01"
$filers = "f-typhon-old"
$N3 = gc $pth\N3_witheveryoneacess_base.txt
foreach ($level3 in $N3) {
$level3old = how too replace datax\level1\level2\level3 with datax\level1.mig\level2\level3
get-acl "\\$filers\$level3old " | set-acl "\\$filerd\$level3"
}
$level3old = $level3 -replace '^\\\\.*?\\(.*?\\[^\\]+)','$1.mig'will replace the system name and add the.mig