File tree Expand file tree Collapse file tree 1 file changed +22
-0
lines changed Expand file tree Collapse file tree 1 file changed +22
-0
lines changed Original file line number Diff line number Diff line change
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 "
You can’t perform that action at this time.
0 commit comments