Click here to Skip to main content
13,087,235 members (54,913 online)
Rate this:
Please Sign up or sign in to vote.
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...
Posted 15-Oct-12 1:49am
Updated 15-Oct-12 20:15pm
ronak123456 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

Rate this: bad
Please Sign up or sign in to vote.

Solution 1

You can't because powershell needs system restart :(
ronak123456 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.
ronak123456 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:
ronak123456 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?
ronak123456 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
ronak123456 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)

  Print Answers RSS
Top Experts
Last 24hrsThis month

Advertise | Privacy |
Web04 | 2.8.170813.1 | Last Updated 16 Oct 2012
Copyright © CodeProject, 1999-2017
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100