From b1bd88ba4996eb1acf2270e88216aba395edb9c4 Mon Sep 17 00:00:00 2001 From: Timothy Wamalwa Date: Fri, 3 May 2024 17:59:55 +0300 Subject: [PATCH] Added migration script --- docs/BreakingChangeMigration.ps1 | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) create mode 100644 docs/BreakingChangeMigration.ps1 diff --git a/docs/BreakingChangeMigration.ps1 b/docs/BreakingChangeMigration.ps1 new file mode 100644 index 0000000000..275b18bc94 --- /dev/null +++ b/docs/BreakingChangeMigration.ps1 @@ -0,0 +1,22 @@ +# Define the path to the CSV file and the script file +$csvPath = "docs\PowerShellBreakingChanges-V1.0.csv" #"docs\PowerShellBreakingChanges-Beta.csv" +$scriptPath = "" +$newScriptPath = "" + +# Import the CSV file +$cmdletMappings = Import-Csv -Path $csvPath + +# Read the script file contents +$scriptContent = Get-Content -Path $scriptPath -Raw + +# Replace old cmdlets with new cmdlets +foreach ($mapping in $cmdletMappings) { + $oldCmdlet = $mapping.OldCmdlet + $newCmdlet = $mapping.NewCmdlet + $scriptContent = $scriptContent -replace $oldCmdlet, $newCmdlet +} + +# Save the updated script content to a new file +$scriptContent | Set-Content -Path $newScriptPath + +Write-Host "Script updated and saved to $newScriptPath" \ No newline at end of file