Click here to Skip to main content
15,391,277 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi All,
How to install powershell and sql server 2008 r2 silent from same batch file.

my batch file code is....

cd nirali
cd xp_powershell
WindowsXP-KB926139-v2-x86-ENU.exe /quiet /passive /norestart 

cd Windows
cd system32
powershell.exe "c:\nirali\SQLEXPRADV2008_x86_ENU.exe /CONFIGURATIONFILE=c:\nirali\ConfigurationFile.ini /INDICATEPROGRESS"

successed to install Powershell but not able to install sql server....
want to install both in same batch file...

Thanks in advance...thanks a lot for your help...
Updated 15-Oct-12 20:15pm
Nirali R shah 15-Oct-12 7:58am
if i run both batch file one by one .. then it installs fine.. no need to restart pc after installation of powershell... it creates issue when using both script in same batch file... :(

1 solution

You can't because powershell needs system restart :(
Nirali R shah 15-Oct-12 7:52am
so is there any solution for the same??
Zoltán Zörgő 15-Oct-12 8:00am
It depends why you want this. Do you install sql server so often, that a manual restart and continuation is not acceptable? Than use an install builder, that can handle prerequisites and postponed installation.
Nirali R shah 15-Oct-12 8:50am
Thank u very much for your reply...please suggest me what can i do for the same? please.....
Zoltán Zörgő 15-Oct-12 9:05am
Many bootstappers and install utils can do this, look here for example:
Nirali R shah 15-Oct-12 9:35am
sorry but not getting any idea from this link.. :(

Zoltán Zörgő 15-Oct-12 9:38am
Again: why do you need this at all?
Nirali R shah 16-Oct-12 1:19am
I want to install sql server 2008 r2 slient from my setup file on XP ... and to install sql server 2008 r2 express it needs powershell... so i want to include both files in same setup file. for that i have created 1 batch file for the commands that installs powershell and sql server...
Zoltán Zörgő 16-Oct-12 2:23am
I could imagine that. But why from batch? Why is a reboot problematic? And why are u using powershell to run the sql server installer? Anyway... try this:

@echo off
REG ADD "HKLM\Software\Microsoft\Windows\CurrentVersion\RunOnce" /v SQLEXPRADV2008_x86_ENU /t REG_SZ /d "c:\nirali\SQLEXPRADV2008_x86_ENU.exe /CONFIGURATIONFILE=c:\nirali\ConfigurationFile.ini /INDICATEPROGRESS"

c:\nirali\cd xp_powershell\WindowsXP-KB926139-v2-x86-ENU.exe /passive /forcereboot

It will add the server installer to the registry to start after reboot, install powershell and reboot
Nirali R shah 16-Oct-12 7:09am
:) :) Thanks a lot for your help and it works.. i only change my code in batch file as below with your help...

cd nirali
cd xp_powershell

@echo off
REG ADD "HKLM\Software\Microsoft\Windows\CurrentVersion\RunOnce" /v SQLEXPRADV2008_x86_ENU /t REG_SZ /d "c:\nirali\SQLEXPRADV2008_x86_ENU.exe /CONFIGURATIONFILE=c:\nirali\ConfigurationFile.ini /INDICATEPROGRESS"

it rocks !!!!!! works!!!! thanks a lot again..
Zoltán Zörgő 16-Oct-12 8:11am
You are welcome!

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900