@@ -50,22 +50,30 @@ function Invoke-ModuleUpgradeStep
50
50
- StartOffset $Step.SourceCommand.StartOffset - EndOffset $Step.SourceCommand.EndOffset
51
51
52
52
# replacement code
53
- $null = $FileContent.Remove ($Step.SourceCommand.StartOffset , ($Step.SourceCommand.EndOffset - $Step.SourceCommand.StartOffset ));
54
- $null = $FileContent.Insert ($Step.SourceCommand.StartOffset , $Step.Replacement );
53
+ $null = $FileContent.Remove ($Step.SourceCommand.StartOffset , ($Step.SourceCommand.EndOffset - $Step.SourceCommand.StartOffset ))
54
+ $null = $FileContent.Insert ($Step.SourceCommand.StartOffset , $Step.Replacement )
55
55
}
56
56
" CmdletParameter"
57
57
{
58
- Write-Verbose - Message (" [{0}] Updating CmdletParameter {1} to {2}." `
59
- -f $Step.Location , $Step.Original , $Step.Replacement )
58
+ if ([System.String ]::IsNullOrWhiteSpace($Step.Replacement ) -eq $false )
59
+ {
60
+ Write-Verbose - Message (" [{0}] Updating CmdletParameter {1} to {2}." `
61
+ -f $Step.Location , $Step.Original , $Step.Replacement )
60
62
61
- # safety check
62
- # ensure that the file offsets are an exact match.
63
- Confirm-StringBuilderSubstring - FileContent $FileContent - Substring $Step.Original `
64
- - StartOffset $Step.SourceCommandParameter.StartOffset - EndOffset $Step.SourceCommandParameter.EndOffset
63
+ # safety check
64
+ # ensure that the file offsets are an exact match.
65
+ Confirm-StringBuilderSubstring - FileContent $FileContent - Substring $Step.Original `
66
+ - StartOffset $Step.SourceCommandParameter.StartOffset - EndOffset $Step.SourceCommandParameter.EndOffset
65
67
66
- # replacement code
67
- $null = $FileContent.Remove ($Step.SourceCommandParameter.StartOffset , ($Step.SourceCommandParameter.EndOffset - $Step.SourceCommandParameter.StartOffset ));
68
- $null = $FileContent.Insert ($Step.SourceCommandParameter.StartOffset , $Step.Replacement );
68
+ # replacement code
69
+ $null = $FileContent.Remove ($Step.SourceCommandParameter.StartOffset , ($Step.SourceCommandParameter.EndOffset - $Step.SourceCommandParameter.StartOffset ))
70
+ $null = $FileContent.Insert ($Step.SourceCommandParameter.StartOffset , $Step.Replacement )
71
+ }
72
+ else
73
+ {
74
+ Write-Verbose - Message (" [{0}] Skipping CmdletParameter {1}, it has no automated replacement." `
75
+ -f $Step.Location , $Step.Original )
76
+ }
69
77
}
70
78
default
71
79
{
0 commit comments