.vbs script as a post installation task?
Hello, i am trying to run a .vbs script as a post install task in a winxp scripted installation, our company like to remove windows messenger and also the in built games, i have found the following scripts to do this:
remove games.vbs:
Dim Fso : Set Fso = CreateObject("Scripting.FileSystemObject")
Set WshShell = WScript.CreateObject("WScript.Shell")
sPrograms = WshShell.SpecialFolders("AllUsersPrograms")
If (Fso.FolderExists(sPrograms & "\Games")) Then
' Create file for uninstalling games
Set f = Fso.CreateTextFile("c:\windows\inf\wmdtocm.txt", True)
f.WriteLine("[Components]")
f.WriteLine("freecell=off")
f.WriteLine("hearts=off")
f.WriteLine("minesweeper=off")
f.WriteLine("msnexplr=off")
f.WriteLine("pinball=off")
f.WriteLine("solitaire=off")
f.WriteLine("spider=off")
f.WriteLine("zonegames=off")
f.Close
WshShell.Run "sysocmgr.exe /i:c:\windows\inf\sysoc.inf /u:""c:\windows\inf\wmdtocm.txt"" /q", 1, True
Fso.DeleteFolder(sPrograms & "\Games"), True
End If
---------------
Remove messenger.vbs:
'xp_messsenger_remove.vbs - Removes Windows Messenger from Windows XP
'© Doug Knox - 3/30/02
'Downloaded from www.dougknox.com
Option Explicit
On Error Resume Next
'Dimension variables
Dim WSHShell, MyBox, p1, q1, rcmd
Dim jobfunc
'Set the Windows Script Host Shell and assign values to variables
Set WSHShell = WScript.CreateObject("WScript.Shell")
p1 = "HKEY_LOCAL_MACHINE\Software\Microsoft\Outlook Express\Hide Messenger"
q1 = 2
rcmd = "RunDll32 advpack.dll,LaunchINFSection %windir%\inf\msmsgs.inf,BLC.Remove"
'Create or change the Hide Messenger value
WSHShell.RegWrite p1, q1
'Run the uninstall command
WshShell.Run(rcmd)
-----------------------------------------------
both run fine from a command prompt on a clean machine and also when double clicked, but when uploaded to the kbox with the command line: remove messenger.vbs / remove games.vbs respectively they do not run. i have tried this uploading the single files and also as a zip of the files.
would anyone be able to shed any light on this?
also is there a log of post installation failures? if so where would it be as this would help greatly.
remove games.vbs:
Dim Fso : Set Fso = CreateObject("Scripting.FileSystemObject")
Set WshShell = WScript.CreateObject("WScript.Shell")
sPrograms = WshShell.SpecialFolders("AllUsersPrograms")
If (Fso.FolderExists(sPrograms & "\Games")) Then
' Create file for uninstalling games
Set f = Fso.CreateTextFile("c:\windows\inf\wmdtocm.txt", True)
f.WriteLine("[Components]")
f.WriteLine("freecell=off")
f.WriteLine("hearts=off")
f.WriteLine("minesweeper=off")
f.WriteLine("msnexplr=off")
f.WriteLine("pinball=off")
f.WriteLine("solitaire=off")
f.WriteLine("spider=off")
f.WriteLine("zonegames=off")
f.Close
WshShell.Run "sysocmgr.exe /i:c:\windows\inf\sysoc.inf /u:""c:\windows\inf\wmdtocm.txt"" /q", 1, True
Fso.DeleteFolder(sPrograms & "\Games"), True
End If
---------------
Remove messenger.vbs:
'xp_messsenger_remove.vbs - Removes Windows Messenger from Windows XP
'© Doug Knox - 3/30/02
'Downloaded from www.dougknox.com
Option Explicit
On Error Resume Next
'Dimension variables
Dim WSHShell, MyBox, p1, q1, rcmd
Dim jobfunc
'Set the Windows Script Host Shell and assign values to variables
Set WSHShell = WScript.CreateObject("WScript.Shell")
p1 = "HKEY_LOCAL_MACHINE\Software\Microsoft\Outlook Express\Hide Messenger"
q1 = 2
rcmd = "RunDll32 advpack.dll,LaunchINFSection %windir%\inf\msmsgs.inf,BLC.Remove"
'Create or change the Hide Messenger value
WSHShell.RegWrite p1, q1
'Run the uninstall command
WshShell.Run(rcmd)
-----------------------------------------------
both run fine from a command prompt on a clean machine and also when double clicked, but when uploaded to the kbox with the command line: remove messenger.vbs / remove games.vbs respectively they do not run. i have tried this uploading the single files and also as a zip of the files.
would anyone be able to shed any light on this?
also is there a log of post installation failures? if so where would it be as this would help greatly.
0 Comments
[ + ] Show comments
Answers (2)
Please log in to answer
Posted by:
riversidekid
14 years ago
Most of my installs are just vb scripts. I usually set up a shutdown monitor so the user will find it difficult to shut down the machine while the install is running, then kick off any install sequence using a run statement with appropriate switches and then any 'clean up' statements. I started this because I needed to run something after the install just as you describe above; I kept doing it because I like consistency in my work. I can perform silent upgrades this way or a visible install with or without user interaction, vb is very flexible.
It's an art, not a science.
It's an art, not a science.
Posted by:
trentderby
14 years ago
Rating comments in this legacy AppDeploy message board thread won't reorder them,
so that the conversation will remain readable.
so that the conversation will remain readable.