none
Install SQL Server 2016 (SCCM program deployment)

    Question

  • Hello guys,

    I need to deploy with SCCM, SQL Server 2016 for about 300 machines with a diferents instance names:ex. MACHINE1-INSTANCE_NAME _01; MACHINE2-INSTANCE_NAME _02; ... etc...

    I have siple install script and a deploying with success:

    Setup.exe" /ACTION=Install /q /IACCEPTSQLSERVERLICENSETERMS /IACCEPTROPENLICENSETERMS /FEATURES=SQLENGINE,FULLTEXT,CONN,IS,SNAC_SDK,BOL /INSTANCENAME="instancename"  /AGTSVCACCOUNT="NT AUTHORITY\Network Service" /SQLSVCACCOUNT="NT Authority\System" /SQLSYSADMINACCOUNTS="user1" "user2" "user3" "user4" /ISSVCACCOUNT="NT AUTHORITY\NETWORK SERVICE"

    How do I modify this script to program read the machine name and fill the parameter /INSTANCENAME with the INSTANCENAME for that machine name?

    Solution: create a .csv file with MACHINE NAME;INSTANCE NAME? Or a PowerShel script? Any ideia, sugestion?

    Thks

    JLV

    Tuesday, March 28, 2017 2:06 PM

All replies

  • Hi j23_123,

     

    I will use Powershell Script and get the machine name and instance name from csv-file, you can refer to the following script:

     

    $machine_name = $(Get-WmiObject Win32_Computersystem).name
    $instance_name=Import-Csv C:\Users\...\Downloads\key.csv 
    |Where-Object {$_.server_name -eq $machine_name} 
    |select -ExpandProperty instance_name
    .\Setup.exe /ACTION=Install /q 
    /IACCEPTSQLSERVERLICENSETERMS 
    /IACCEPTROPENLICENSETERMS 
    /FEATURES=SQLENGINE,FULLTEXT,CONN,IS,SNAC_SDK,BOL 
    /INSTANCENAME=$instance_name  
    /AGTSVCACCOUNT="NT AUTHORITY\Network Service" 
    /SQLSVCACCOUNT="NT Authority\System" 
    /SQLSYSADMINACCOUNTS="user1" "user2" "user3" "user4" 
    /ISSVCACCOUNT="NT AUTHORITY\NETWORK SERVICE"


    The csv-file looks like below:

     

    server_name instance_name

    ----------- -------------

    server01    instance1   

    server02    instance2   

     

    Best Regards,

    Teige



    MSDN Community Support
    Please remember to click "Mark as Answer" the responses that resolved your issue, and to click "Unmark as Answer" if not. This can be beneficial to other community members reading this thread. If you have any compliments or complaints to MSDN Support, feel free to contact MSDNFSF@microsoft.com.

    Wednesday, March 29, 2017 7:37 AM
    Moderator
  • Hi j23_123,

     

    I will use Powershell Script and get the machine name and instance name from csv-file, you can refer to the following script:

     

    $machine_name = $(Get-WmiObject Win32_Computersystem).name
    $instance_name=Import-Csv C:\Users\...\Downloads\key.csv 
    |Where-Object {$_.server_name -eq $machine_name} 
    |select -ExpandProperty instance_name
    .\Setup.exe /ACTION=Install /q 
    /IACCEPTSQLSERVERLICENSETERMS 
    /IACCEPTROPENLICENSETERMS 
    /FEATURES=SQLENGINE,FULLTEXT,CONN,IS,SNAC_SDK,BOL 
    /INSTANCENAME=$instance_name  
    /AGTSVCACCOUNT="NT AUTHORITY\Network Service" 
    /SQLSVCACCOUNT="NT Authority\System" 
    /SQLSYSADMINACCOUNTS="user1" "user2" "user3" "user4" 
    /ISSVCACCOUNT="NT AUTHORITY\NETWORK SERVICE"


    The csv-file looks like below:

     

    server_name instance_name

    ----------- -------------

    server01    instance1   

    server02    instance2   

     

    Best Regards,

    Teige



    MSDN Community Support
    Please remember to click "Mark as Answer" the responses that resolved your issue, and to click "Unmark as Answer" if not. This can be beneficial to other community members reading this thread. If you have any compliments or complaints to MSDN Support, feel free to contact MSDNFSF@microsoft.com.

          Our instance name and all the information is stored as a system variables. We need to retrieve the name and can be used with script.

    Thursday, June 22, 2017 8:57 AM