Solved

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
2
391 Views
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.
0
Comment
Question by:TDKD
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
2 Comments
 
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
BlackICE Defender
Blackice.exe

http://www.computerperformance.co.uk/vbscript/wmi_services.htm#Example_1_-_A_WMI_Script_to_List_the_Services_running_on_Computer

' Expanded upon base script by 
' Author Guy Thomas http://computerperformance.co.uk/
' 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(objService.name) = UCase(BIname) then
		bIFound = true
		Exit for
	End if
Next
 
If bIFound Then
	WScript.Echo "BlackIce firewall installed"
 Else
	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

0
 
LVL 65

Accepted Solution

by:
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....

Regards,

Rob.
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
Next
 
If boolFound = True Then
	MsgBox "You have the BlackIce firewall installed.  Microsoft Office 2003 will not be installed."
Else
	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
	Next
	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!"""
	Else
		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

0

Featured Post

[Webinar] Learn How Hackers Steal Your Credentials

Do You Know How Hackers Steal Your Credentials? Join us and Skyport Systems to learn how hackers steal your credentials and why Active Directory must be secure to stop them. Thursday, July 13, 2017 10:00 A.M. PDT

Question has a verified solution.

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

Welcome, welcome!  If you are new to the series and haven't been following along, please take a brief moment to review the first three installments: Part 1 (http://www.experts-exchange.com/Programming/Languages/Visual_Basic/VB_Script/A_266-VBScri…
When you see single cell contains number and text, and you have to get any date out of it seems like cracking our heads.
Do you want to know how to make a graph with Microsoft Access? First, create a query with the data for the chart. Then make a blank form and add a chart control. This video also shows how to change what data is displayed on the graph as well as form…
In this video you will find out how to export Office 365 mailboxes using the built in eDiscovery tool. Bear in mind that although this method might be useful in some cases, using PST files as Office 365 backup is troublesome in a long run (more on t…

632 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