Packaging EXE ignoring modules

Already discussed with Adam but in case someone else as a workaround.

I want to package modules with my script but ignore one module because it can only be runned remotely on an exchange server. When I use

IgnoredModules = [string]@(‘ADSync’)

the merge-script fails. Here’s the line that the merge-script isn’t interpretting correctly:
$Command = {Import-Module ADSync | Start-ADSyncSyncCycle -PolicyType Delta | Exit-PSSession}

and here’s the error (sry it’s in french):
Merge-Script : Au caractère Ligne:1815 : 2

  • | Start-ADSyncSyncCycle -PolicyType Delta | Exit-PSSession}
  • ~
    Un élément de canal vide n’est pas autorisé.
    Au caractère Ligne:1 : 1
  • Merge-Script -Verbose -ConfigFile 'c:\Users\cgagnon\Desktop\tools\use …
  •   + CategoryInfo          : InvalidOperation : (:) [Merge-Script], Exception
      + FullyQualifiedErrorId : PowerShellToolsPro.Cmdlets.MergeScriptCommand
    
    

clearly there’s something about the syntax with the pipe that the merge-script doesn’t like but i’m unsure how to resolve this.