PowerShell execute Sqlpackage.exe remotely

Welcome Forums General PowerShell Q&A PowerShell execute Sqlpackage.exe remotely

This topic contains 2 replies, has 2 voices, and was last updated by

2 years ago.

  • Author
  • #63922

    Points: 0
    Rank: Member

    I am trying to execute the sqlpackage.exe remotely as follows
    $SqlPackage = "C:\SqlPackage.exe"
    [string[]] $Properties = @("/p:DropObjectsNotInSource=true","/p:ScriptDatabaseCompatibility=true","/p:CommandTimeout=0", "/p:RegisterDataTierApplication=true")


    $p="$Params $Properties"
    Invoke-Command -ScriptBlock {& $SqlPackage } -ArgumentList @p -Session $session

    But I got an exception as follows

    A positional parameter cannot be found that accepts argument 'A'.
    So can some one help me how to resolve

  • #63928

    Points: 24
    Team Member
    Rank: Member

    Please try below:

    Invoke-Command -Session $session -ScriptBlock { Start-Process -NoNewWindow -Wait -FilePath ${Using:SqlPackage} -ArgumentList "${Using:Params} ${Using:Properties}" }
  • #64065

    Points: 0
    Rank: Member

    Hi Daniel I am getting an error as file not found, to be more clear I need to install on B machine and I am running the script from A machine where the two machines are remotely connected.

    $SqlPackage = "C:\SqlPackage.exe"

    this path is from A machine

The topic ‘PowerShell execute Sqlpackage.exe remotely’ is closed to new replies.

denizli escort samsun escort muğla escort ataşehir escort kuşadası escort