First off, let me know if I could present this a little clearer.
I am setting up an environment to allow developers to sync web development from one stage/qa server to two identical production servers. Our current environment uses a powershell script and msdeploy. It is spotty at best. Also the infrastructure is old and needs replacement. I copied the script from our current environment to the new one. When I run the current script on the new machines I get a number of errors. I have eliminated most of them. I still get the following
Beginning sync process on acp-web01....
Invoke-Expression : At line:1 char:61
+ 'C:\Program Files\IIS\Microsoft Web Deploy V3\msdeploy.exe' -verb:sync
-source:a ...
+ ~~~~~
Unexpected token '-verb' in expression or statement.
At line:1 char:66
+ 'C:\Program Files\IIS\Microsoft Web Deploy V3\msdeploy.exe' -verb:sync
-source:a ...
+ ~~~~~
Unexpected token ':sync' in expression or statement.
At D:\srvutil\sync-ProductionSites.ps1:132 char:2
+ Invoke-Expression $Exec
+ ~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : ParserError: (:) [Invoke-Expression], ParseExcep
tion
+ FullyQualifiedErrorId : UnexpectedToken,Microsoft.PowerShell.Commands.In
vokeExpressionCommand
This is the part of the script that I think is generating the error:
Write-Host "`nBeginning sync process on $Server...." -Foregroundcolor Yellow
$CommandLine="C:\Program Files\IIS\Microsoft Web Deploy V3\msdeploy.exe"
$Params="`-verb`:sync `-source`:apphostconfig=$siteName `-dest`:apphostconfig=$siteName`,computername=$Server `–enablelink`:apppool > C`:`\SrvUtil`\$Server`.log"
$Exec = "'$CommandLine' $params"
# Create Remote PowerShell session on $Server
$serverSession = New-PSSession -ComputerName $server
# Execute remote AppPool shutdown
Invoke-Command -Session $serverSession -ScriptBlock $sbStopAppPool -ArgumentList $siteName
# Push Site
Invoke-Expression $Exec
The error is identical on both destination servers
When the Invoke expression runs the error appears. I can approach this in 2 basic ways; one is to fix what I have the other is to scrap it all and start fresh with a new approach. I am open to either
Thanks for the help
Mike