Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8299301
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 8, 20262026-06-08T16:05:57+00:00 2026-06-08T16:05:57+00:00

I have created the following Powershell script which I hope to use to copy

  • 0

I have created the following Powershell script which I hope to use to copy files to a network share.

function Copy-Deploy
{
 param(
  [Parameter(Position=0,Mandatory=$true,HelpMessage="Path to scripts")]
  [Alias("pth")]
  [string]$ScriptPath,

  [Parameter(Position=1,Mandatory=$true,HelpMessage="Deployment script filename")]
  [Alias("dep")]
  [string]$PowershellDeploymentScript,

  [Parameter(Position=2,Mandatory=$true,HelpMessage="MSI filename")]
  [Alias("m")]
  [string]$MSI,

  [Parameter(Position=3,Mandatory=$true,HelpMessage="Filename of the MSBuild script (.btdfproj)")]
  [Alias("msb")]
  [string]$MSBuildScript,

  [Parameter(Position=4,HelpMessage="UNC path to target server folder")]
  [Alias("server")]
  [string]$TargetServerPath

  )

 $ErrorActionPreference="Stop"

 #Step 1 : copy the MSI, .btdfproj script and control powershell script to the remote server
 Write-Host " Going to enter the mis script block"
 $misScript =
 {
    Write-Host " Path+Filename = {0}({1})" -f $ScriptPath, $PowershellDeploymentScript
    Write-Host " Going to copy files" 
    Write-Host " ScriptPath = $ScriptPath"
    Write-Host " PowershellDeploymentScript = $PowershellDeploymentScript"
    Write-Host " MSI = $MSI"
    Write-Host " MSBuildScript = $MSBuildScript"
    Write-Host " TargetServerPath = $TargetServerPath"


    Copy-Item -Path "$ScriptPath" + "$PowershellDeploymentScript" -Destination "$TargetServerPath"
    Copy-Item -Path "$ScriptPath" + "$MSI" -Destination "$TargetServerPath"
    Copy-Item -Path "$ScriptPath" + "$MSBuildScript" -Destination "$TargetServerPath"
 }
 Invoke-Command -scriptblock $misScript

 #Step2 : Execute the powershell script ExecuteBizTalkAppMSI.ps1 remotely on the target server
 #using syntax... invoke-command -computer $MachineName -command { $TargetServerPath + ExecuteBizTalkAppMSI.ps1 }" 

}

I run this script from the Powershell ISE with the following line:

Copy-Deploy "C:\Builds\3\x.Int.MIS\SupportBTDF\Sources\x.Int.MIS\Dev\V1.0\Src\Solutions\MIS\x.Int.MIS.Deployment\" "ExecuteBizTalkAppMSI.ps1" "bin\debug\x.Int.MIS-3.0.0.msi" "x.Int.MIS.Deployment.btdfproj" "\\d-vasbiz01\BizTalkDeployment"

I then get the following error:

Cannot bind parameter 'ForegroundColor'. Cannot convert value "C:\Builds\3\x.Int.MIS\SupportBTDF\Sources\x.Int.MIS\Dev\V1.0\Src\Solutions\MIS\x.Int.MIS.Deployment\,ExecuteBizTalkAppMSI.ps1" to type "System.ConsoleColor" due to invalid enumeration values. Specify one of the following enumeration values and try again. The possible enumeration values are "Black, DarkBlue, DarkGreen, DarkCyan, DarkRed, DarkMagenta, DarkYellow, Gray, DarkGray, Blue, Green, Cyan, Red, Magenta, Yellow, White".At C:\Builds\3\x.Int.MIS\SupportBTDF\Sources\x.Int.MIS\Dev\V1.0\Src\Solutions\MIS\x.Int.MIS.Deployment\CopyDeployScriptThenExecute.ps1:79 char:16

Could anyone please tell me where I went wrong?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-08T16:05:59+00:00Added an answer on June 8, 2026 at 4:05 pm

    The line :

    Write-Host " Path+Filename = {0}({1})" -f $ScriptPath, $PowershellDeploymentScript
    

    is the problem.

    Write it like this:

    Write-Host (" Path+Filename = {0}({1})" -f $ScriptPath, $PowershellDeploymentScript)
    

    The -f was being taken as the -ForegroundColor parameter than the string format operator.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

In Java I have created the following class which extends ImageView to create a
I have created following function to fill field of a form page, there is
I have created the following form with qt designer. I added a Add Files
Actually i have created following procedure,which is working fine. CREATE or REPLACE PROCEDURE GET_NOS(
I created a PowerShell script which loops over a large number of XML Schema
I have a Powershell Script which is stored in a string called script with
I have a PowerShell script with the following excerpt: foreach ($pc in $ComputerName) {
I have created following stored user defined it gets executed successfully. CREATE FUNCTION spherical_distance1(@a
I have several log files which is named by the following pattern Log_yyyy_M_d.log Log_2010_7_1.log
I have created following rule in the .htaccess file located at the root of

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.