Link to home
Start Free TrialLog in
Avatar of bsharath
bsharathFlag for India

asked on

Need to install IIS on 100 machines

Hi,

I need to install IIS in 100 machines is there a easy way to do this remotely and unattended.Can i have the script for this please.

Regards
Sharath
Avatar of Brugh
Brugh

wow.

have you considered the security risk for doing this?  and the network traffic it will create?

maybe a little more detail on what you are trying to achieve by having IIS on 100 computers will help clarify things a bit more...  because in general, it sounds like something that is not good.
Avatar of bsharath

ASKER

zephyr_hex

I dont understand the security risk in this.All the 100 computers are useed by developers and they need to do there development for which they need IIS installed.
And then,

"MSI Installer for IIS"
http://www.topshareware.com/InstallAware-Express-for-Windows-Installer-download-39591.htm

create the MSI package for IIS and assign/publish the package via Group Policy Software to just the pc's that need it.

zf
Zoofan
I tried this link.

http://www.iis-digest.com/?page_id=114

I get this error when i follow the steps.have you done this before if yes can you help...

---------------------------
Windows Setup
---------------------------
The application could not be initialized.
---------------------------
OK  
---------------------------
Have run this on 2k pro machines to setup for a IIS lab yes, and did work corretly.  Check your unattend file and most importatly your command line for typo's

zf
Sysocmgr.exe /i:%windir%\inf\sysoc.inf /u:%PathToUnattendFile%


replace  %windir%  with the path to your windows dir,  c:WINNT or c:\Windows

replace %PathToUnattendFile% with the path to your newly created unattendfile ex:  c:\iis\unattend.txt (where you put the txt file)


zf
Just retested on an 03 server and worked just fine.

zf

Also just tested on XP pro sp2 worked fine,  has to be your path information is incorrect.

zf
Side note,  if the orginal source path for the install is unavailable it will ask for the cd.

this can be found at

[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion]
"SourcePath"="D:\\I386"

if it was a cd based install you can create a share on a server and change this regkey to the share path
"SourcePath"="\\server\i386files"

zf
Any way to give the i386 path in the unattended file itself.As if would be easier
I am using this.

Sysocmgr.exe /i: c:\windows\inf\sysoc.inf /u: c:\IIS_unattended.txt

Is it correct
I am running this on a windows 2003 machine...
ASKER CERTIFIED SOLUTION
Avatar of zoofan
zoofan
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
One second, Ill get you a fix for that,

zf
Create a pclist file,  list all pc's that need the change

pcname1
pcname2
pcname3

This will change the key for you on the remote's  be sure to enter the path to the I386 folder directly when prompted.

I have tested several times, please retest on single pc before implementing out.

your script!

'===Start copy: setsource.vbs===
' ---------------------------------------------------------------'
' setsource.vbs
' 'Sample VBScript to query remote computers
' 'and reset install source path
' ''Author Riley C. aka ZooFan
' '''Version 1.0 - August 2007
' ''''https://www.experts-exchange.com question ID:
' ---------------------------------------------------------------'
'
Option Explicit
Const ForReading = 1, ForWriting = 2, ForAppending = 3 'FileObject Access Type
Const TristateUseDefault = -2, TristateTrue = -1, TristateFalse = 0 'FileObject Format Type
Dim strPcList
Dim arrPcnames()
Dim strResultsFile
Dim dte
Dim tme
Dim objFso
Dim objWshShell
Dim objPCnames
Dim objReadFile
Dim intLneCount
Dim objOutputFile
Dim strCurPath
Dim intPCLoop
Dim strReturn      
Dim strTestcon
Dim strSourcePath
      Set objFso = CreateObject("Scripting.FileSystemObject")
      Set objWshShell = WScript.CreateObject("WScript.Shell")
      strCurPath = CreateObject("Scripting.FileSystemObject").GetAbsolutePathName(".")
      strSourcePath = InputBox("Please enter the full path to the I386" & VbCrLf & "folder on the server share" & VbCrLf & "\\server\03srv\i386","Change Source Path.")
      If strSourcePath = "" Then
                  MsgBox "You must enter a path!",vbOKOnly,"Change Source Path."
                WScript.Quit(0)
      End if                
      strPcList = InputBox("Please enter the full path and file" & VbCrLf & "name of the file with the computer names.","Change Source Path.")
            'Test to make sure file exists if not exit script
            If Not objFso.FileExists(strPcList) Then
                  MsgBox "You must enter a valid full path and file name!",vbOKOnly,"Change Source Path."
                WScript.Quit(0)
            ElseIf strPcList = "" Then
                  MsgBox "You must enter a filename!",vbOKOnly,"Change Source Path."
                WScript.Quit(0)               
            Else 'File exists continue
                                    dte = Replace(FormatDateTime(date(),vbshortdate),"/","-")
                                    tme = Replace(Replace(FormatDateTime(now(),vbLongtime),":","-")," ","")
                                          strResultsFile = strCurPath & "\" & tme & "_" & dte & ".csv"
                                                If objFSO.FileExists(strResultsFile) Then
                                                      ObjFSO.deleteFile(strResultsFile)
                                                Else
                                                      Set objOutputFile = objFso.CreateTextFile(strResultsFile)
                                                      objOutputFile.Close      
                                                End If
                                                MsgBox strResultsFile
                                    Set objPCnames = objFso.GetFile(strPcList)
                                    Set objReadFile = objPCnames.OpenAsTextStream(ForReading, TristateUseDefault)
                                          Do Until objReadFile.AtEndOfStream
                                                ReDim Preserve arrPCnames(intLneCount)
                                                arrPCnames(intLneCount) = objReadFile.ReadLine
                                                intLneCount = intLneCount + 1
                                          Loop
                                    objReadFile.Close
                                          Set objOutputFile = objFso.OpenTextFile(strResultsFile,ForWriting,TristateUseDefault)
                                          objOutputFile.WriteLine("Computer,Response")
                                                For intPCLoop = LBound(arrPCnames) To UBound(arrPCnames)
                                                      strTestcon = IsServerOn(arrPCnames(intPCLoop))
                                                      If strTestcon = "0" Then                                                
                                                      strReturn = setSource(arrPCnames(intPCLoop),strSourcePath)
                                                      objOutputFile.WriteLine(arrPCnames(intPCLoop) & "," & strReturn)
                                                      Else
                                                      objOutputFile.WriteLine(arrPCnames(intPCLoop) & "," & strTestcon)
                                                      End If
                                                Next
                                           objOutputFile.Close
                                           MsgBox("Script has completed")
                                    WScript.Quit
                        End If
Function setSource(strcomputer, strSource)
Dim objSetShell, RegLocate
Dim objRemReg
Set objSetShell = WScript.CreateObject("WScript.Shell")
Set objRemReg = GetObject("winmgmts://" & strcomputer & "/root/default:StdRegProv")
'On Error Resume Next
RegLocate = "HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\SourcePath"
      objSetShell.RegWrite RegLocate, strSource, "REG_SZ"
setSource = "Source Path Changed"
Set objSetShell = Nothing
Set objRemReg = Nothing      
End Function

Function IsServerOn(strserver)                        
      Dim Testme
      Dim intErr
      Dim strRegValue
      Dim strFileServer
      On Error Resume Next
            Set Testme = GetObject("winmgmts://" & strserver & "/root/cimv2")
                  Set strRegValue = GetObject("winmgmts://" & strserver & "/root/default:StdRegProv")
                        intErr = Err.Number
                        If intErr <> 0 Then
                              IsServerOn = Err.Description
                        Else
                              IsServerOn = "0"
                        End If
      On Error GoTo 0
End Function
Function readtextfile(strTxtFile, arrname())
On Error Resume Next
      Dim intErr, intLines
      Dim objTxtLines, objReadFile,objFso      
            Set objFso = CreateObject("Scripting.FileSystemObject")
            Set objTxtLines = objFso.GetFile(strTxtFile)
            Set objReadFile = objTxtLines.OpenAsTextStream(ForReading, TristateUseDefault)
                  Do Until objReadFile.AtEndOfStream
                        ReDim Preserve arrname(intLines)
                        arrname(intLines) = objReadFile.ReadLine
                        intLines = intLines + 1
                  Loop
            objReadFile.Close
            Set objFso = nothing
            Set objTxtLines = Nothing
            Set objReadFile = Nothing
                  intErr = Hex(Err.Number)
                        If intErr <> 0 Then
                              readtextfile = Err.Description
                        Else
                              readtextfile = "0"
                        End If
On Error GoTo 0                        
End Function
'===End copy: setsource.vbs===


any problems let me know,


zf
Excellent zoofan the script worked great and even the i386 path change script worked....