Skip to content

Commit fdb434c

Browse files
authored
Merge pull request #2719 from microsoftgraph/add-mgrationscript
Adds migration script for the breaking changes
2 parents 8cedcf7 + b1bd88b commit fdb434c

File tree

1 file changed

+22
-0
lines changed

1 file changed

+22
-0
lines changed

docs/BreakingChangeMigration.ps1

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
# Define the path to the CSV file and the script file
2+
$csvPath = "docs\PowerShellBreakingChanges-V1.0.csv" #"docs\PowerShellBreakingChanges-Beta.csv"
3+
$scriptPath = "<Path to your script>"
4+
$newScriptPath = "<Path to save the updated script>"
5+
6+
# Import the CSV file
7+
$cmdletMappings = Import-Csv -Path $csvPath
8+
9+
# Read the script file contents
10+
$scriptContent = Get-Content -Path $scriptPath -Raw
11+
12+
# Replace old cmdlets with new cmdlets
13+
foreach ($mapping in $cmdletMappings) {
14+
$oldCmdlet = $mapping.OldCmdlet
15+
$newCmdlet = $mapping.NewCmdlet
16+
$scriptContent = $scriptContent -replace $oldCmdlet, $newCmdlet
17+
}
18+
19+
# Save the updated script content to a new file
20+
$scriptContent | Set-Content -Path $newScriptPath
21+
22+
Write-Host "Script updated and saved to $newScriptPath"

0 commit comments

Comments
 (0)