Jump to content

add and remove programs


Recommended Posts

hello

when i add programs in server2003 64bit it ask for the install cd or the rc2 folder and the amd64 folder

i am useing this Script i have found from this web site

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

Dim ws, fs, windir, colDrives, objDrive, strCD
Set ws = WScript.CreateObject("WScript.Shell")
Set fs = CreateObject("Scripting.FileSystemObject")
windir = ws.ExpandEnvironmentStrings ("%SYSTEMROOT%")
Set colDrives = fs.Drives
For Each objDrive in colDrives
If fs.FileExists(objDrive.DriveLetter & ":\WIN51") Then strCD = objDrive.DriveLetter & ":"
Next

'**********************************************************************
'** Subroutine; Copy the i386 folder from the source media and make **
'** the appropriate registry entries. **
'**********************************************************************
Sub CopySource
Dim strKeyPath
strKeyPath = "HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Setup\"
fs.CopyFolder (strCD & "\i386"), (windir & "\i386"),True
If fs.FolderExists(windir & "\i386\svcpack") Then fs.DeleteFolder(windir & "\i386\svcpack"),True
ws.RegWrite strKeyPath & "SourcePath", "%systemroot%\\i386\\", "REG_SZ"
ws.RegWrite strKeyPath & "ServicePackSourcePath", "%systemroot%\\i386\\", "REG_SZ"
End Sub

'**********************************************************************
'** Run Tasks **
'**********************************************************************
CopySource

but it still asks for the cd's has anyone had this problem before, or is there any way around this

many thanks

Link to comment
Share on other sites


Perhaps the script could check of the existence of the WIN51 file?


Dim ws, fs, windir, colDrives, objDrive, strCD, checkfile
Set ws = WScript.CreateObject("WScript.Shell")
Set fs = CreateObject("Scripting.FileSystemObject")
windir = ws.ExpandEnvironmentStrings ("%SYSTEMROOT%")
Set colDrives = fs.Drives
checkfile = False
For Each objDrive in colDrives
If fs.FileExists(objDrive.DriveLetter & ":\WIN51") Then
strCD = objDrive.DriveLetter & ":"
checkfile = True
Exit For
End If
Next

'**********************************************************************
'** Subroutine; Copy the i386 folder from the source media and make **
'** the appropriate registry entries. **
'**********************************************************************
Sub CopySource
Dim strKeyPath
strKeyPath = "HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Setup\"
fs.CopyFolder (strCD & "\i386"), (windir & "\i386"),True
If fs.FolderExists(windir & "\i386\svcpack") Then fs.DeleteFolder(windir & "\i386\svcpack"),True
ws.RegWrite strKeyPath & "SourcePath", "%systemroot%\\i386\\", "REG_SZ"
ws.RegWrite strKeyPath & "ServicePackSourcePath", "%systemroot%\\i386\\", "REG_SZ"
End Sub

'**********************************************************************
'** Run Tasks **
'**********************************************************************
If checkfile Then
CopySource
Else
MsgBox "No Win51 file found in the root of any drive"
End If

Link to comment
Share on other sites

I have made a couple of changes to the script. This works like this

1:\ Checks to see if the drive is ready

2:\ Checks if the drive is a CD or DVD drive

3:\ Checks for a filein the i386 folder

4:\ If all three are true then it does the copy and reg stuff

5:\ Will report if there was no source CD or DVD

Option Explicit 
Dim Act :Set Act = CreateObject("Wscript.Shell")
Dim Fso :Set Fso = CreateObject("Scripting.FileSystemObject")
Dim WD :WD = Act.ExpandEnvironmentStrings("%SYSTEMROOT%")
Dim Key :Key = "HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Setup\"
Dim Chk1, Drv

For Each Drv In Fso.Drives
If Drv.DriveType = 4 Then
If Drv.IsReady Then
If Fso.FileExists(Drv & "\i386\Zoneoc.dl_") Then
Chk1 = True
Fso.CopyFolder (Drv & "\i386"), (WD & "\i386"),True
If Fso.FolderExists(WD & "\i386\svcpack") Then Fso.DeleteFolder(WD & "\i386\svcpack"),True
Act.RegWrite Key & "SourcePath", "%systemroot%\\i386\\", "REG_SZ"
Act.RegWrite Key & "ServicePackSourcePath", "%systemroot%\\i386\\", "REG_SZ"
Exit For
End If
Else
Chk1 = False
End If
End If
Next

If Chk1 = False Then
MsgBox "No CD or DVD Source, was found",4128,"No Source"
Else
MsgBox "Completed Copy And Reg",4128,"Completed"
End If

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...