It works for simple example scripts I've tried. What's the code after the if statements when it fails for you?
For most languages, dynamic surround runs off statement tagging information. PowerShell doesn't have a statement tagger, so dynamic surround will fall back on some simple defaults. Which usually means pulling in code one line at a time.