SQL server installation through Powershell

  • Hello ,

    I'm looking for automated SQL server installation process via powershell

    I don't know why my script does not support the path defined for the data file or log file or the path of the backup it always takes the default value C: \ Program Files \ Microsoft SQL Server \

    attached My script

    $HostName = Hostname
    D:\Setup.exe /ACTION=Install /FEATURES=SQLEngine,Replication,IS,Conn,FullText `
    /INSTANCENAME=Abdallah`
    /SQLSVCACCOUNT="NT Service\MSSQLServer" `
    /AGTSVCACCOUNT="NT Service\SQLServerAgent" `
    /FTSVCACCOUNT="NT Service\MSSQLFDLauncher" `
    /ISSVCACCOUNT="NT Service\MsDtsServer150" `
    /AGTSVCSTARTUPTYPE="Automatic" `
    /TCPENABLED="1" `
    /FILESTREAMLEVEL="3" `
    /FILESTREAMSHARENAME="MSSQLSERVER" `
    /INSTALLSQLDATADIR="c:\backup" `
    /SQLBACKUPDIR="c:\Backup" `
    /SQLUSERDBDIR="c:\backup" `
    /SQLUSERDBLOGDIR="c:\backup" `
    /SQLTEMPDBFILECOUNT=4 `
    /UpdateEnabled=FALSE `
    /SECURITYMODE=SQL /SAPWD="admin" /SQLSYSADMINACCOUNTS="$Hostname\Administrateur" `
    /SQLUSERDBDIR="c:\backup" `
    /SQLUSERDBLOGDIR="c:\backup" `
    /SQLTEMPDBDIR="c:\backup" `
    /SQLTEMPDBLOGDIR="c:\backup" `
    /SQLTEMPDBFILESIZE=256 `
    /SQLTEMPDBFILEGROWTH=64 `
    /SQLTEMPDBLOGFILESIZE=256 `
    /SQLTEMPDBLOGFILEGROWTH=256 `
    /HELP="False" /INDICATEPROGRESS="False" /QUIET="True" /QUIETSIMPLE="False" `
    /X86="False" /ENU="True" /ERRORREPORTING="False" /SQMREPORTING="False" `
    /SQLSVCINSTANTFILEINIT=TRUE `
    /IACCEPTSQLSERVERLICENSETERMS

    CLEAR

    Sans titre

    thank you for your help

     

     

    Attachments:
    You must be logged in to view attached files.
  • Thanks for posting your issue and hopefully someone will answer soon.

    This is an automated bump to increase visibility of your question.

  • The $Hostname is not parsed at runtime. You need to hardcode the hostname, or use an .ini file.

    Or, try my approach and  use dbatools:

    https://github.com/cviorel/Presentations/blob/main/2021/new_stars_of_data/03_DeployLab/06_install-sql.ps1

    this way you can install multiple instances at once, in parallel.

    Hope this helps!

Viewing 3 posts - 1 through 2 (of 2 total)

You must be logged in to reply to this topic. Login to reply