Automation Issue

wkrouthwkrouth Posts: 3 New member
edited March 5, 2024 10:17PM in Redgate Monitor
I've been trying to following the updateautomation guide for the most part. I'm not too savvy with powershell, but I've got the web msi installation part to work, just not the base msi. Anyone have an idea what is the problem? (redacting data connection info of course) 

Downloading the SQLMonitor.exe, extracting the web msi from it, installing that, then extracting the base msi from the C:\Program Files\Red Gate\SQL Monitor\Web\wwwroot\Download\SQLMonitorBaseMonitorInstaller.exe all seem to work fine.

When this part of the script runs, msiexec justs pops up like you launched it without any arguments.

$MSIArguments = @(
    "/i",
    "SQLMonitor_BaseMonitor.msi",
    "I_AGREE_TO_THE_EULA=yes",
    "SERVICETYPE=local",
    "SERVICERPCPORTNUM=7399",
     "DATACONNECTION=Data Source=**********;Initial Catalog=**********;User ID=**********;Password=**********;Max Pool Size=500;Connect Timeout=15;Encrypt=True;Trust Server Certificate=False;Packet Size=8000",
    "/quiet",
    "/norestart",
    "/l*v .\Logs\SQLMonitor-Base-$DateStamp-log.txt"
)

# Step 2 - Change Directory to Base Monitor Directory
Set-Location "C:\Program Files\Red Gate\SQL Monitor\Automation\Downloads\Base"

Write-Host "Installing Base Monitor Service"

# Start msiexec with the arguments
Start-Process -FilePath "msiexec.exe" -ArgumentList $MSIArguments -Wait -NoNewWindow

Best Answer

  • Alex BAlex B Posts: 1,157 Diamond 4
    Hi @wkrouth

    Righto, I think I've figured it out.  The problem is the quoting around the data connection string.  It needs to be single quotes on the outside with double quotes around the connection string itself.
    'DATACONNECTION="Data Source=**********,3342;Initial Catalog=**********;User ID=**********;Password=**********;Max Pool Size=500;Connect Timeout=15;Encrypt=True;Trust Server Certificate=False;Packet Size=8000"',
    In both the unquoted and single inside double quoted example it was causing the mandatory DATACONNECTION parameter to be missed and that's what caused msiexec to pop up the window.  

    Please give that a try and let me know if it now works and I'll work on updating the documentation.

    Kind regards,
    Alex
    Product Support Engineer | Redgate Software

    Have you visited our Help Center?

Answers

  • Alex BAlex B Posts: 1,157 Diamond 4
    Hi @wkrouth,

    It looks like you don't have the connection string enclosed in single quotes inside the double quotes.  It should look like this with single quotes ' after the equal = sign and before the ending double quote ".
    "DATACONNECTION='<Connection string>'",

    that is
    "DATACONNECTION='Data Source=**********;Initial Catalog=**********;User ID=**********;Password=**********;Max Pool Size=500;Connect Timeout=15;Encrypt=True;Trust Server Certificate=False;Packet Size=8000'",
    Does that change the behavior?

    Kind regards,
    Alex
    Product Support Engineer | Redgate Software

    Have you visited our Help Center?
  • wkrouthwkrouth Posts: 3 New member
    Hey Alex, thanks for responding!

    My current version of the script, with unfortunately the same result;

    # Step 1 - Create Arguments List - See Documentation Page for Possible Values to Configure #
     
    $MSIArguments = @(
    "/i",
    "SQLMonitor_BaseMonitor.msi",
    "I_AGREE_TO_THE_EULA=yes",
    "SERVICETYPE=local",
    "SERVICERPCPORTNUM=7399",
    "DATACONNECTION='Data Source=**********,3342;Initial Catalog=**********;User ID=**********;Password=**********;Max Pool Size=500;Connect Timeout=15;Encrypt=True;Trust Server Certificate=False;Packet Size=8000'",
    "/quiet",
    "/norestart",
    "/l*v .\Logs\SQLMonitor-Base-$DateStamp-log.txt"
    )
     
    # Step 2 - Change Directory to Web.msi Directory #
     
    Set-Location "C:\Program Files\Red Gate\SQL Monitor\Automation\Downloads\Base"
     
    Write-Host "Installing Base Monitor Service"
     
    Start-Process "msiexec.exe" -ArgumentList $MSIArguments -Wait -NoNewWindow
  • wkrouthwkrouth Posts: 3 New member
    Looks like that was the fix! I appreciate it!
Sign In or Register to comment.