TDKD
asked on
I am in need of a vbs script or batch file that will...
I need a script 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.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Hi RobSampson,
Thanks, I will try it tomorrow and get back to you.
Thanks, I will try it tomorrow and get back to you.
No problem.
ASKER
Hi RobSampson,
I am going to give you the points, because you are brilliant!! But could you help me incorporate this batch file below, you see I have a script that will check for the "Blackd.exe" process and then runs this batch file below, as long as the "Blackd.exe" process is not running (ultimately I will remove this application if it exists). I like your script better because it actually searches for the existence of the "BlackIce Application", so I would rather use yours. The reason I want to use the batch file below is because it runs a few things the basic MSI package does not cover (e.g. I use the transform line in order to use the preconfigured O2K3 install and I install the EmailXtender add-on for Outlook. I also stop McAfee before installing, then I restart McAfee, then I run a shutdown command for XP and 2K clients.
The Script that runs first: ß But I like yours better J
Option Explicit
' Change these variables as required
dim strRequiredProcess: strRequiredProcess="Blackd .exe"
dim strBatchFile: strBatchFile="install\Inst allOffice2 003.bat"
if not QueryProcess(strRequiredPr ocess, ".") then
' Process is not running, so run batch file
dim objShell: set objShell=CreateObject("WSc ript.Shell ")
objShell.Run """" & strBatchFile & """"
set objShell=Nothing
end if
function QueryProcess(ByVal strProcess, strComputer)
' Returns true if service is running on given computer
Dim objWMIService, objProcess, colProcess
Dim strProc, blnFound
blnFound=false
strProcess=LCase(strProces s)
Set objWMIService = GetObject("winmgmts:{imper sonationLe vel=impers onate}!\\" & strComputer & "\root\cimv2")
Set colProcess = objWMIService.ExecQuery("S elect * from Win32_Process")
on error resume next
For Each objProcess in colProcess
strProc=lcase(objProcess.E xecutableP ath)
if Right(strProc, Len(strProcess))=strProces s then
wscript.echo "Contact the Help Desk before proceeding to the next step"
blnFound=true
exit for
end if
Next
Err.Clear
on error goto 0
QueryProcess=blnFound
end function
The Batch file that runs if Blackd.exe is NOT running:
net stop "McAfee Framework Service"
net stop "Network Associates McShield"
net stop "Network Associates Task Manager"
xcopy "\\IP Address\Shared\Dantona\Off ice2003\in stall\pssh utdown.exe " c:\
\\IP Address\Shared\Dantona\Off ice2003\in stall\setu ppro.exe TRANSFORMS=Stratus.MST /qb-
\\IP Address\Shared\Dantona\Off ice2003\in stall\excl ientsetup. exe /s /v"/qn INSTALLDIR=\"c:\Program Files\Legato\" ADDLOCAL=Sea,Common,Doc SEL_EXCHANGE=1 EX_EXSERVER=EXArchive"
net start "McAfee Framework Service"
net start "Network Associates McShield"
net start "Network Associates Task Manager"
;Windows XP Users--
shutdown.exe -r -t 30 -c "Office 2003 has finished upgrading and will now restart your PC!"
;Windows 2000 Users--
c:\psshutdown -r -m "Office 2003 has finished upgrading and will now restart your PC!"
exit
I am going to give you the points, because you are brilliant!! But could you help me incorporate this batch file below, you see I have a script that will check for the "Blackd.exe" process and then runs this batch file below, as long as the "Blackd.exe" process is not running (ultimately I will remove this application if it exists). I like your script better because it actually searches for the existence of the "BlackIce Application", so I would rather use yours. The reason I want to use the batch file below is because it runs a few things the basic MSI package does not cover (e.g. I use the transform line in order to use the preconfigured O2K3 install and I install the EmailXtender add-on for Outlook. I also stop McAfee before installing, then I restart McAfee, then I run a shutdown command for XP and 2K clients.
The Script that runs first: ß But I like yours better J
Option Explicit
' Change these variables as required
dim strRequiredProcess: strRequiredProcess="Blackd
dim strBatchFile: strBatchFile="install\Inst
if not QueryProcess(strRequiredPr
' Process is not running, so run batch file
dim objShell: set objShell=CreateObject("WSc
objShell.Run """" & strBatchFile & """"
set objShell=Nothing
end if
function QueryProcess(ByVal strProcess, strComputer)
' Returns true if service is running on given computer
Dim objWMIService, objProcess, colProcess
Dim strProc, blnFound
blnFound=false
strProcess=LCase(strProces
Set objWMIService = GetObject("winmgmts:{imper
Set colProcess = objWMIService.ExecQuery("S
on error resume next
For Each objProcess in colProcess
strProc=lcase(objProcess.E
if Right(strProc, Len(strProcess))=strProces
wscript.echo "Contact the Help Desk before proceeding to the next step"
blnFound=true
exit for
end if
Next
Err.Clear
on error goto 0
QueryProcess=blnFound
end function
The Batch file that runs if Blackd.exe is NOT running:
net stop "McAfee Framework Service"
net stop "Network Associates McShield"
net stop "Network Associates Task Manager"
xcopy "\\IP Address\Shared\Dantona\Off
\\IP Address\Shared\Dantona\Off
\\IP Address\Shared\Dantona\Off
net start "McAfee Framework Service"
net start "Network Associates McShield"
net start "Network Associates Task Manager"
;Windows XP Users--
shutdown.exe -r -t 30 -c "Office 2003 has finished upgrading and will now restart your PC!"
;Windows 2000 Users--
c:\psshutdown -r -m "Office 2003 has finished upgrading and will now restart your PC!"
exit
ASKER
Could you help me with this portion??
Hi, I am not able to test this, but instead of my "objShell.Run strCommand" line, I've replaced all that with a VBScript implementation of your batch file.....which I think should work.....
Regards,
Rob.
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
ASKER
Thanks very much Rob!! I will try it out, and thanks again for the follow up :-)
ASKER
If this works Rob, I will open another question and award you more points, as you already answered my first question...
I will inform you here as to the next question and how it will be named.
I will inform you here as to the next question and how it will be named.
Thanks. Just post the link to the new question, and I will follow it up.
Glad to help.
Regards,
Rob.
Glad to help.
Regards,
Rob.
ASKER
Hi RobSampson,
I didn't know how to get in touch with you on here?? So I figured I would add a message here...can you help me with this question of mine??
https://www.experts-exchange.com/questions/26316614/In-need-of-VBS-script-to-do-what-my-batch-file-does-an-additional-message-or-two.html?cid=1575&anchorAnswerId=33169812#a33169812
I didn't know how to get in touch with you on here?? So I figured I would add a message here...can you help me with this question of mine??
https://www.experts-exchange.com/questions/26316614/In-need-of-VBS-script-to-do-what-my-batch-file-does-an-additional-message-or-two.html?cid=1575&anchorAnswerId=33169812#a33169812
WHERE Caption LIKE '%BlackIce%'
that may not be specific enough, if there's more than one service with BlackIce in it, so you can change that if required.
Rob.