Reputation: 1
I'm trying to make this script work which automates App-V 5.0 installation using PowerShell. I'm installing it on Windows Server 2012 R2 With SQL 2012. Whenever it reaches Invoke-Expression $installappv, nothing happens. I can see the setup file start for a few seconds in task manager, but nothing gets installed. Please help.
.\AppVInstall\AppVServer\appv_server_setup.exe /layout
$appvconf = Get-Content .\AppVInstall\AppVServer\AppV_Conf.ini
$appvparameters = $appvconf -join " "
$installappv = ".\AppVInstall\AppVServer\appv_server_setup.exe" + " " + $appvparameters
Invoke-Expression $installappv
This is the contents of the file ".\AppVInstall\AppVServer\AppV_Conf.ini"
/QUIET
/ACCEPTEULA
/MANAGEMENT_SERVER
/MANAGEMENT_ADMINACCOUNT="XXXX.local\XXXXX"
/MANAGEMENT_WEBSITE_NAME="Microsoft App-V Management Service"
/MANAGEMENT_WEBSITE_PORT="80"
/DB_PREDEPLOY_MANAGEMENT
/MANAGEMENT_DB_SQLINSTANCE_USE_DEFAULT
/MANAGEMENT_DB_NAME="AppVManagement"
/PUBLISHING_SERVER /PUBLISHING_MGT_SERVER="testappvsvr.XXXX.local:80";
/PUBLISHING_WEBSITE_NAME="Microsoft AppV Publishing Service"
/PUBLISHING_WEBSITE_PORT="81"
Upvotes: 0
Views: 286
Reputation: 1
@Matt I figured out the problem. The setup doesn't except changes to the default port numbers from the INI. Those parameters must be changed after the install. Thanks for your help Matt.
Upvotes: 0
Reputation: 46730
Invoke-Expression
is treating your string like 2 commands because of the semi-colon.
Consider the following statements.
Example 1
PS C:\temp> Invoke-Expression "echo test;stuff test"
test
stuff : The term 'stuff' is not recognized as the name of a cmdlet, function, ....output truncated...
Example 2
PS C:\temp> Invoke-Expression "echo 'test;stuff test'"
test;stuff test
In the first example the semicolon is not escaped or encased in quotes. It is a line terminator in PowerShell so it is treating 'stuff test'
as its own command stuff
with test
as an argument. I don't have a cmdlet or exe called stuff
so I get an error. I think that's what happening to you. A chunk of your parameters are not being sent to appv_server_setup.exe
.
In the second example the semicolon is in single quote so the entire string is output on one line.
I don't know if it needs to be there but that semicolon has to be addressed somehow so that Invoke-Expression
does not see it all by its lonesome.
Perhaps you can wrap all the arguments in one set of quotes.
$appvparameters = "'$($appvconf -join "' '")'"
Upvotes: 0