Page 1 of 1 1
Topic Options
#169445 - 2006-10-16 07:20 PM Simple script - running from a c: prompt can any help
pimpjuice Offline
Fresh Scripter

Registered: 2006-09-25
Posts: 17
Loc: Fort Lauderdale, FL
Im trying to run a simple command from a DOS prompt. The command is following:

netsh firewall add portopening protocol=TCP port=5900 name="VNCEnterprise2" mode=enable scope=subnet

So would my scirpt look like this

? "Configuring the Windows Firewall"
Shell '%COMSPEC% /C "netsh firewall add portopening protocol=TCP port=5900 name="VNCEnterprise2" mode=enable scope=subnet"

Top
#169446 - 2006-10-16 07:33 PM Re: Simple script - running from a c: prompt can any help
NTDOC Administrator Offline
Administrator
*****

Registered: 2000-07-28
Posts: 11634
Loc: Space
Are you 100% certain that the command as you show does work at a C:\ prompt?

If so, then no your syntax being shelled will probably not work.

I have to run for a few but will post when I get back with a syntax that will hopefully work if no one else posts in the mean time.

Top
#169447 - 2006-10-16 08:02 PM Re: Simple script - running from a c: prompt can any help
Les Offline
KiX Master
*****

Registered: 2001-06-11
Posts: 12734
Loc: fortfrances.on.ca
You have mismatched quotes.
Top
#169448 - 2006-10-16 08:12 PM Re: Simple script - running from a c: prompt can any help
Lonkero Administrator Offline
KiX Master Guru
*****

Registered: 2001-06-05
Posts: 22346
Loc: OK
and the line won't work as it is on command prompt either.
Top
#169449 - 2006-10-17 01:13 AM Re: Simple script - running from a c: prompt can any help
technicalx Offline
Fresh Scripter

Registered: 2006-10-16
Posts: 5
Loc: dallas, texas
pimpjuice,

google on context...it's a scripting editor that replaces notepad (if you opt too). very handy for catching coding or syntax errors.

...about the commands, can't tell what brand of FW you have.

Top
#169450 - 2006-10-17 01:45 AM Re: Simple script - running from a c: prompt can any help
NTDOC Administrator Offline
Administrator
*****

Registered: 2000-07-28
Posts: 11634
Loc: Space
The best approach (imho) would be to use a GPO to set this.

Doing it remotely may or may not work with NETSH depending on how the system is currently configured.

Here is an article that discusses the many ways to change it.


http://www.windowsecurity.com/articles/Customizing-Windows-Firewall.html

Top
#169451 - 2006-10-17 01:51 AM Re: Simple script - running from a c: prompt can any help
NTDOC Administrator Offline
Administrator
*****

Registered: 2000-07-28
Posts: 11634
Loc: Space
As for the shelling out it should look more like this.

NOT TESTED

 
Shell '%COMSPEC% /C ' + 'netsh firewall add portopening protocol=TCP port=5900 name='+'"'+'VNCEnterprise2'+'"'+' mode='+'"'+'enable'"'+' scope='+'"'+'subnet'+'"'

Top
#169452 - 2006-10-17 02:41 AM Re: Simple script - running from a c: prompt can any help
Les Offline
KiX Master
*****

Registered: 2001-06-11
Posts: 12734
Loc: fortfrances.on.ca
DOC, WTF??? Why all the concatenation?
Top
#169453 - 2006-10-17 03:15 AM Re: Simple script - running from a c: prompt can any help
NTDOC Administrator Offline
Administrator
*****

Registered: 2000-07-28
Posts: 11634
Loc: Space
Cause I love it.


Okay, here does this float your boat better?

SHELL '%COMSPEC% /C netsh firewall add portopening protocol=TCP port=5900 name="VNCEnterprise2" mode="enable" scope="subnet"'

Top
#169454 - 2006-10-17 02:53 PM Re: Simple script - running from a c: prompt can any help
Les Offline
KiX Master
*****

Registered: 2001-06-11
Posts: 12734
Loc: fortfrances.on.ca
Much better.
Top
Page 1 of 1 1


Moderator:  Jochen, Allen, Radimus, Glenn Barnas, ShaneEP, Ruud van Velsen, Arend_, Mart 
Hop to:
Shout Box

Who's Online
0 registered and 2220 anonymous users online.
Newest Members
Viginette, ManuvdWielNL, Sir_Barrington, batdk82, StuTheCoder
17888 Registered Users

Generated in 0.072 seconds in which 0.038 seconds were spent on a total of 12 queries. Zlib compression enabled.

Search the board with:
superb Board Search
or try with google:
Google
Web kixtart.org