VMware Cloud Community
tomkivlin
Contributor
Contributor
Jump to solution

Unattended vCenter Installation - INSTALLDIR problems

I have been using the published PDF that gives assistance on performing unattended vCenter Server installs: http://www.vmware.com/files/pdf/techpaper/vcenter_server_cmdline_install.pdf

I have this mostly working, but one part is not working, and I think I've nailed it down to the INSTALLDIR switch for the various MSI files.

For example, this command doesn't work (it brings up the msi help window):

$arguments = ' /qr ADMINPASSWORD=' + $SSOpasswd + ' DEPLOYMODE=FIRSTDOMAIN SSO_SITE=' + $SSOsite + ' INSTALLDIR=' + $InstallDIR /L*v D:\VCS-INSTALL-LOGS\ssoinstall.log'

Start-Process -FilePath 'D:\Installs\vCS\VMware-SSO-Service.msi' -ArgumentList $arguments

However, simply removing the INSTALLDIR switch does allow for the installation to occur, e.g.

$arguments = ' /qr ADMINPASSWORD=' + $SSOpasswd + ' DEPLOYMODE=FIRSTDOMAIN SSO_SITE=' + $SSOsite + ' /L*v D:\VCS-INSTALL-LOGS\ssoinstall.log'

Start-Process -FilePath 'D:\Installs\vCS\VMware-SSO-Service.msi' -ArgumentList $arguments

The PDF does suggest that this switch is available.  In addition, I have tested that switch in place with no spaces and no double-quotes, so it doesn't appear to be a double-quotes/escape character problem. I am also using double-quotes and escape characters elsewhere for passwords etc. so it shouldn't be that either..

I've confirmed it's a problem (for me at least) for:

SSO

Web Client

Inventory Service

vCenter Server

ESXi Dump Collector

Syslog Collector

Any ideas?

I'm trying this using vCenter Server 5.5 Update 2 installing onto Server 2012 R2 using PowerShell (4).

Thanks,

Tom

Reply
0 Kudos
1 Solution

Accepted Solutions
tomkivlin
Contributor
Contributor
Jump to solution

At the moment it is:

$InstallDIR = "D:\Program Files\VMware\Infrastructure"

Worth noting:

1. I've also tried with an escape character with double-quotes in the argument variable (as per the PDF in my original post):

$exe = "$VCmedia\Single Sign-On\VMware-SSO-Server.msi"

$myargs = ' /qr ADMINPASSWORD=' + $SSOpasswd + ' DEPLOYMODE=FIRSTDOMAIN SSO_SITE=' + $SSOsite + ' INSTALLDIR=\"' + $InstallDIR + '\"'

2. I've also tried with the PowerShell escape character (`) - same result:

$exe = "$VCmedia\Single Sign-On\VMware-SSO-Server.msi"

$myargs = ' /qr ADMINPASSWORD=' + $SSOpasswd + ' DEPLOYMODE=FIRSTDOMAIN SSO_SITE=' + $SSOsite + ' INSTALLDIR=`"' + $InstallDIR + '`"'

3. I've also tried with a path that has no spaces - this works:

$exe = "$VCmedia\Single Sign-On\VMware-SSO-Server.msi"

$myargs = ' /qr ADMINPASSWORD=' + $SSOpasswd + ' DEPLOYMODE=FIRSTDOMAIN SSO_SITE=' + $SSOsite + ' INSTALLDIR=D:\VMware'

So, that does point to a problem with spaces/quotes - but I am not sure what I'm doing wrong...

I've added a line so it looks like this now:

$exe = "$VCmedia\Single Sign-On\VMware-SSO-Server.msi"

$myargs = ' /qr ADMINPASSWORD=' + $SSOpasswd + ' DEPLOYMODE=FIRSTDOMAIN SSO_SITE=' + $SSOsite + ' INSTALLDIR=`"' + $InstallDIR + '`"'

$myargs = $myargs + ' /L*v D:\VCS-INSTALL-LOGS\ssoinstall.log'

Write-Host "Command: Start-Process $exe $myargs -Wait"

Start-process $exe $myargs -Wait

The output of the Write-Host shows this:

Command: Start-Process D:\INSTALLS\vCS\\Single Sign-On\VMware-SSO-Server.msi  /qr ADMINPASSWORD=Hello!2 DEPLOYMODE=FIRSTDOMAIN SSO_SITE=VCS-SSO INSTALLDIR=`"D:\Program Files\VMware\Infrastructure`" /L*v D:\VCS-INSTALL-LOGS\ssoinstall.log -Wait

The escape character is still there - suggesting I don't understand how to use it!  I just removed it from the script and it works, so commands are now:

$exe = "$VCmedia\Single Sign-On\VMware-SSO-Server.msi"

$myargs = ' /qr ADMINPASSWORD=' + $SSOpasswd + ' DEPLOYMODE=FIRSTDOMAIN SSO_SITE=' + $SSOsite + ' INSTALLDIR="' + $InstallDIR + '"'

$myargs = $myargs + ' /L*v D:\VCS-INSTALL-LOGS\ssoinstall.log'

Write-Host "Command: Start-Process $exe $myargs -Wait"

Start-process $exe $myargs -Wait

Write-Host now says:

Command: Start-Process D:\INSTALLS\vCS\\Single Sign-On\VMware-SSO-Server.msi  /qr ADMINPASSWORD=Hello!2 DEPLOYMODE=FIRSTDOMAIN SSO_SITE=VCS-SSO INSTALLDIR="D:\Program Files\VMware\Infrastructure" /L*v D:\VCS-INSTALL-LOGS\ssoinstall.log -Wait

Personally, I'm surprised this works but that's cool, I'm still learning - I'll try and look up some more information about double-quotes, spaces and the behaviour of variables when passed to a cmdlet.

View solution in original post

Reply
0 Kudos
3 Replies
a_p_
Leadership
Leadership
Jump to solution

What's the content of the $InstallDIR variable? Does it contain blanks and/or does it contain the path in double quotes?

André

tomkivlin
Contributor
Contributor
Jump to solution

At the moment it is:

$InstallDIR = "D:\Program Files\VMware\Infrastructure"

Worth noting:

1. I've also tried with an escape character with double-quotes in the argument variable (as per the PDF in my original post):

$exe = "$VCmedia\Single Sign-On\VMware-SSO-Server.msi"

$myargs = ' /qr ADMINPASSWORD=' + $SSOpasswd + ' DEPLOYMODE=FIRSTDOMAIN SSO_SITE=' + $SSOsite + ' INSTALLDIR=\"' + $InstallDIR + '\"'

2. I've also tried with the PowerShell escape character (`) - same result:

$exe = "$VCmedia\Single Sign-On\VMware-SSO-Server.msi"

$myargs = ' /qr ADMINPASSWORD=' + $SSOpasswd + ' DEPLOYMODE=FIRSTDOMAIN SSO_SITE=' + $SSOsite + ' INSTALLDIR=`"' + $InstallDIR + '`"'

3. I've also tried with a path that has no spaces - this works:

$exe = "$VCmedia\Single Sign-On\VMware-SSO-Server.msi"

$myargs = ' /qr ADMINPASSWORD=' + $SSOpasswd + ' DEPLOYMODE=FIRSTDOMAIN SSO_SITE=' + $SSOsite + ' INSTALLDIR=D:\VMware'

So, that does point to a problem with spaces/quotes - but I am not sure what I'm doing wrong...

I've added a line so it looks like this now:

$exe = "$VCmedia\Single Sign-On\VMware-SSO-Server.msi"

$myargs = ' /qr ADMINPASSWORD=' + $SSOpasswd + ' DEPLOYMODE=FIRSTDOMAIN SSO_SITE=' + $SSOsite + ' INSTALLDIR=`"' + $InstallDIR + '`"'

$myargs = $myargs + ' /L*v D:\VCS-INSTALL-LOGS\ssoinstall.log'

Write-Host "Command: Start-Process $exe $myargs -Wait"

Start-process $exe $myargs -Wait

The output of the Write-Host shows this:

Command: Start-Process D:\INSTALLS\vCS\\Single Sign-On\VMware-SSO-Server.msi  /qr ADMINPASSWORD=Hello!2 DEPLOYMODE=FIRSTDOMAIN SSO_SITE=VCS-SSO INSTALLDIR=`"D:\Program Files\VMware\Infrastructure`" /L*v D:\VCS-INSTALL-LOGS\ssoinstall.log -Wait

The escape character is still there - suggesting I don't understand how to use it!  I just removed it from the script and it works, so commands are now:

$exe = "$VCmedia\Single Sign-On\VMware-SSO-Server.msi"

$myargs = ' /qr ADMINPASSWORD=' + $SSOpasswd + ' DEPLOYMODE=FIRSTDOMAIN SSO_SITE=' + $SSOsite + ' INSTALLDIR="' + $InstallDIR + '"'

$myargs = $myargs + ' /L*v D:\VCS-INSTALL-LOGS\ssoinstall.log'

Write-Host "Command: Start-Process $exe $myargs -Wait"

Start-process $exe $myargs -Wait

Write-Host now says:

Command: Start-Process D:\INSTALLS\vCS\\Single Sign-On\VMware-SSO-Server.msi  /qr ADMINPASSWORD=Hello!2 DEPLOYMODE=FIRSTDOMAIN SSO_SITE=VCS-SSO INSTALLDIR="D:\Program Files\VMware\Infrastructure" /L*v D:\VCS-INSTALL-LOGS\ssoinstall.log -Wait

Personally, I'm surprised this works but that's cool, I'm still learning - I'll try and look up some more information about double-quotes, spaces and the behaviour of variables when passed to a cmdlet.

Reply
0 Kudos
tomkivlin
Contributor
Contributor
Jump to solution

There is a however, however..

For the paths that use an exe, yuo do need the backslash escape character, for example:

$exe = "$VCmedia\vSphere-WebClient\VMware-WebClient.exe"

$myargs = '/L1033 /V" /qr SSO_ADMIN_PASSWORD=\"' + $SSOpasswd + '\"' + ' INSTALLDIR=\"' + $InstallDIR + '\"'

$myargs = $myargs + ' LS_URL=\"https://' + $vcenterIP + ':7444/lookupservice/sdk\" HTTP_PORT=9090 HTTPS_PORT=9443'

$myargs = $myargs + ' /L*v D:\VCS-INSTALL-LOGS\weblient_install.log"'

Write-Host "Command: Start-Process $exe $myargs -Wait"

Start-process $exe $myargs -Wait

This produces:

Command: Start-Process D:\INSTALLS\vCS\vSphere-WebClient\VMware-WebClient.exe /L1033 /V" /qr SSO_ADMIN_PASSWORD=\"Hello!2\" INSTALLDIR=\"D:\Program Files\VMware\Infrastructure\" LS_URL=\"https://192.168.106.12:7444/lookupservice/sdk\" HTTP_PORT=9090 HTTPS_PORT=9443 /L*v D:\VCS-INSTALL-LOGS\weblient_install.log" -Wait

This works.

So basically it was me not reading the instructions properly and not understanding PowerShell well enough. My bad.

Reply
0 Kudos