Richie
Member
Registered: 3rd Dec 02
Location: Newport, Wales
User status: Offline
|
But im a dribbler when it comes to VB script.
Can anyone help?
|
Dom
Member
Registered: 13th Sep 03
User status: Offline
|
just google for the batch file equivalent in VBScript, it's fairly simple - though if you need to output anything then a message box is about as far as it goes unless you're going to embedded it into a HTML page in which case the worlds your oyster.
what does the batch file do anyways?
|
Richie
Member
Registered: 3rd Dec 02
Location: Newport, Wales
User status: Offline
|
Adds a bunch of firewall rules on vista....
@echo off
echo Adding Windows Firewall Rules......
echo.
echo.
echo.
pause
set OFPATH="%ProgramFiles%\Microsoft Office\Office12"
netsh firewall add allowedprogram program = %OFPATH%\GROOVE.EXE name = "Microsoft Office Groove" mode = ENABLE profile = ALL
netsh firewall add allowedprogram program = %OFPATH%\ONENOTE.EXE name = "Microsoft Office OneNote" mode = ENABLE profile = ALL
netsh firewall add allowedprogram program = %OFPATH%\OUTLOOK.EXE name = "Microsoft Office Outlook" mode = ENABLE profile = ALL
ECHO Firewall Rules Added Sucessfully......
pause
exit
|
Richie
Member
Registered: 3rd Dec 02
Location: Newport, Wales
User status: Offline
|
Scaredy cats
|
Dom
Member
Registered: 13th Sep 03
User status: Offline
|
look at the objshell function under VBScript, im not 100% clued up but something like -
code:
Option Explicit
Dim objShell
Dim strPath as String
strPath = "%ProgramFiles%\Microsoft Office\Office12"
Set objShell = CreateObject("WScript.Shell")
objShell.Run("netsh firewall add allowedprogram program = " & strPath & "\GROOVE.EXE name = 'Microsoft Office Groove' mode = ENABLE profile = ALL")
Wscript.Sleep 1500
WScript.Quit
|
James
Member
Registered: 1st Jun 02
Location: Surrey
User status: Offline
|
objShell isnt a function its an object, pretty sure those last two lines should be objShell.Sleep and objShell.Quit too.
But apart from that, providing there aren't any syntax errors, the above should work.
[Edited on 18-10-2007 by James]
|
Richie
Member
Registered: 3rd Dec 02
Location: Newport, Wales
User status: Offline
|
Manged to get it working using this in the end (didnt need groove or onenote either)
Dim oShell
Set oShell = WScript.CreateObject ("WSCript.shell")
oShell.run "cmd /K""netsh firewall add allowedprogram program= ""C:\Program Files\Microsoft Office\Office12\OUTLOOK.EXE"" ""Microsoft Office Outlook 2007"" profile = ALL & exit """""""
Set oShell = nothing
|