Automated install of SQL Server, Workflows or DSC???

Hey all, 

Trying to improve my installs of sql server by automating it all with powershell. 

i had a basic idea of

  • running a bunch of checks before install, setting up things (format drives, create folders, add service account to local security)
  • then running an install / slipstream (use a config file). 
  • then running the standard post install scripts to configure the instance (create maintenace plans, add standard extra accounts, monitoring etc). 

So far im coming up with a lot of issues for keeping this simple.. 

namely. things like

to add a domain account to a local security group i need to turn off UAC. (Which needs a reboot)

Ive got a check to see if a reboot is needed (Our server team like to patch and not reboot!) but again if i reboot im starting from scratch again and re-running the script..

 

Looking at it. Workflows and DSC seem to be the answer. I was originally thinking DSC but i need to do so many checks before the install part.. Im starting to think workflows is more whats needed?!.... 

 

I've never done any work with either and maybe im running to buzz words for solutions? .. does anyone have any experience using either of them for there install builds? maybe not specific to SQL install but something else 

Any suggestions or input would be greatly appreciated! 

 

  • I'm not sure why UAC would be an issue here, if you launch the script with administrative privileges then UAC should never appear for none of the actions you are attempting to perform. Could you give me an example of how you are executing your script?

  • Hey,

    So problem i had was with changing the local security. I tried to do it via:

    www.littlekendra.com/.../

    and 

    sqldbamusings.blogspot.co.uk/.../powershell-adding-accounts-to-local.html

    but both failed when running posh with Admin rights, i found a post on stackoverflow saying it was because of UAC being on..  and there being no way around it..  so i was thinking, turn off UAC -> restart -> run steps / install -> enable UAC. 

     

     

  • If you start your console with "Run as administrator" it should have no problems.  In the console window, it you type "whoami /priv" and it only returns five rights, you are not running as admin.  It should return around 20 (depending on the OS)

  • Hey, 

    Admittedly this is a tried once scenario. but with UAC on, running ISE with admin rights and without it would fail to complete. Ive just turned off UAC, restarted and run the commands and its worked :/ 

    Ill turn it back on and try again.. I have a check before to see if the ISe is running in admin based of a scripting guy script. 

    ## Check if running with admin rights

    If (-NOT ([Security.Principal.WindowsPrincipal] [Security.Principal.WindowsIdentity]::GetCurrent()).IsInRole(`

        [Security.Principal.WindowsBuiltInRole] "Administrator"))

    {

        Write-Warning "You do not have Administrator rights to run this script!`nPlease re-run this script as an Administrator!"

        Break

    }

     

    I would need a restart in a build if the server was patched and not restarted. so im still interested in with views on the Workflows installs or  with DCS if there is any 

  • The point with DSC is that you will still need to start DSC with administrative credentials. If you are running into permissions errors that are stopping you from executing a PowerShell script I don't see how this will be different using DSC or Workflows since you will still initiate this from PowerShell.

  • Hi Jaap, 

    from what it said on the forum its a none thing when try and change local security with UAC on..  running the code i got from scripting guy showed it was running in admin, and i can do any other admin style task fine.. its just that security task that i have issue with.. 

     

    Have you tried installing SQL with DSC how did you find it?

     

    thanks again

     

  • I actually haven't installed SQL using DSC yet. I found this blog post on MSDN that could help you started with this:

    http://blogs.msdn.com/b/powershell/archive/2014/02/13/configuring-a-sql-high-availability-group-with-dsc.aspx

    If you do attempt to install SQL using DSC please let us know your progress.