I am in need of a vbs script that will append my existing batchfile and script into a single vbs script?

Posted on 2008-10-24
Last Modified: 2008-10-27
I am in need of a vbs script or batch file that will check for the existance of the "BlackIce" firewall Service (or application location), and depending on whether or not it exists a different message box would greet the user, also if the "BlackIce" does not exist if the script could then invoke the "Office 2003" setup.exe.
Question by:TDKD
LVL 32

Assisted Solution

by:Robberbaron (robr)
Robberbaron (robr) earned 100 total points
ID: 22802178
need to know the name of the service...
likely to be one of these
BlackICE Defender

' Expanded upon base script by 

' Author Guy Thomas

' Version 1.5 December 2005

' -------------------------------------------------------'

Option Explicit

Dim objWMIService, objItem, objService, strServiceList

Dim colListOfServices, strComputer, strService

Dim objShell

Dim BIname, OffSetup, bIFound

BIname = "BlackICE Defender"

OffSetup = "X:\Off2003\Setup.exe"

' ---------------------------------------------------------

' Pure WMI commands

strComputer = "."

Set objWMIService = GetObject("winmgmts:" _

	& "{impersonationLevel=impersonate}!\\" _

	& strComputer & "\root\cimv2")

Set colListOfServices = objWMIService.ExecQuery _

	("Select * from Win32_Service ")

bIFound= False

' WMI and VBScript loop

For Each objService in colListOfServices

	If UCase( = UCase(BIname) then

		bIFound = true

		Exit for

	End if


If bIFound Then

	WScript.Echo "BlackIce firewall installed"


	WScript.Echo "BlackIce firewall not found."  & vbCrLf & "Proceeding to Office Install"

End If

If Not bIfound Then

	Set objShell = CreateObject("Wscript.Shell")

	objShell.Run OffSetup,,0   

End if

Open in new window

LVL 65

Accepted Solution

RobSampson earned 400 total points
ID: 22805671
Hi, something like this should do it.  I have also included the batch file code you used in a previous question to install Office....


Const wbemFlagReturnImmediately = &h10

Const wbemFlagForwardOnly = &h20

strComputer = "."

Set objWMIService = GetObject("winmgmts:\\" & strComputer & "\root\CIMV2")

Set colItems = objWMIService.ExecQuery("SELECT Caption FROM Win32_Service WHERE Caption LIKE '%BlackIce%'", "WQL", _

                                       wbemFlagReturnImmediately + wbemFlagForwardOnly)


boolFound = False

For Each objItem In colItems

	boolFound = True



If boolFound = True Then

	MsgBox "You have the BlackIce firewall installed.  Microsoft Office 2003 will not be installed."


	MsgBox "Microsoft Office 2003 will now be installed."

	Set objShell = CreateObject("WScript.Shell")

	Set objFSO = CreateObject("Scripting.FileSystemObject")

	objShell.Run "net stop ""McAfee Framework Service""", 1, True

	objShell.Run "net stop ""Network Associates McShield""", 1, True

	objShell.Run "net stop ""Network Associates Task Manager""", 1, True

	objFSO.CopyFile "\\IP Address\Shared\Dantona\Office2003\install\psshutdown.exe", "C:\", True

	objShell.Run "\\IP Address\Shared\Dantona\Office2003\install\setuppro.exe TRANSFORMS=Stratus.MST /qb-", 1, True

	objShell.Run "\\IP Address\Shared\Dantona\Office2003\install\exclientsetup.exe /s /v""/qn INSTALLDIR=\""c:\Program Files\Legato\"" ADDLOCAL=Sea,Common,Doc SEL_EXCHANGE=1 EX_EXSERVER=EXArchive""", 1, True

	objShell.Run "net start ""McAfee Framework Service""", 1, True

	objShell.Run "net start ""Network Associates McShield""", 1, True

	objShell.Run "net start ""Network Associates Task Manager""", 1, True

	Set colItems = objWMIService.ExecQuery("SELECT Caption FROM Win32_OperatingSystem", "WQL", _

                                       wbemFlagReturnImmediately + wbemFlagForwardOnly)

	For Each objItem In colItems

		strCaption = objItem.Caption


	If InStr(strCaption, "XP") > 0 Then

		objShell.Run "shutdown.exe -r -t 30 -c ""Office 2003 has finished upgrading and will now restart your PC!"""


		objShell.Run "c:\psshutdown -r -m ""Office 2003 has finished upgrading and will now restart your PC!"""

	End If

End If

Open in new window


Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Welcome to part one of a multi-part tutorial series, VBScript for Windows System Administrators.  The goal of this series is to teach non-programmers how to write useful VBS code to automate their environment, and perform tasks faster, and in a more…
Over the years I have built up my own little library of code snippets that I refer to when programming or writing a script.  Many of these have come from the web or adaptations from snippets I find on the Web.  Periodically I add to them when I come…
Migrating to Microsoft Office 365 is becoming increasingly popular for organizations both large and small. If you have made the leap to Microsoft’s cloud platform, you know that you will need to create a corporate email signature for your Office 365…
Hi friends,  in this video  I'll show you how new windows 10 user can learn the using of windows 10. Thank you.

867 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

22 Experts available now in Live!

Get 1:1 Help Now