0

In short, I am running a silent install of SQL Server 2016 using a *.ini file. At the end of the installation, I must restart to use any sort of sqlcmd/invoke-sqlcmd to call a SQL file.

Does anyone know of a method (preferably PowerShell) that can forgo a restart and run those commands?

  • 1
    Does this answer your question? [Skip restarting during SQL Server installation](https://superuser.com/questions/399481/skip-restarting-during-sql-server-installation) – Ramhound Mar 03 '22 at 20:19
  • 1
    Have you tried [/SkipRules=RebootRequiredCheck](https://stackoverflow.com/questions/176857/installation-problem-sql-server-2008)? – Ramhound Mar 03 '22 at 20:21

1 Answers1

0

I ran into an identical issue when trying to create SQL server users with sqlcmd after a silent install.

I solved it by using Chocolatey's Update-SessionEnviorment powershell script found here:

https://github.com/chocolatey/choco/blob/master/src/chocolatey.resources/helpers/functions/Update-SessionEnvironment.ps1

I just copied all of the required functions into a .ps1 file and called the separate file from the main script to keep everything clean.

Sidenote: They also have a similar script for cmd if you are doing this in batch and not powershell

https://github.com/chocolatey-archive/chocolatey/blob/master/src/redirects/RefreshEnv.cmd