Created
August 5, 2022 13:48
Revisions
-
SQLvariant created this gist
Aug 5, 2022 .There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,11 @@ <# Search for something inside an ADF file and replace it. #> $Datasets = dir 'C:\temp\MDD-ADF-Test-Repo\dataset' -Recurse foreach($Dataset in $Datasets.Where({$_.Mode -ne 'd----'})){ $Dataset.Name if((Get-Content $Dataset.FullName | foreach{ $_ -match 'AzureSqlDatabase1' }) -eq $true ){"Fix it" (Get-Content $Dataset.FullName).Replace('Azure_SqlDatabase1', 'MDD_SampleSQL_LS') | Set-Content -Path $Dataset.FullName } else{"Nothing to do"} } <# This isn't limited to just Datasets. you can go up one level and do the replace on every directory if you include the -Recurse parameter. #>