Re: Idea for ISA Blocking Scripts on isatools.org

  • From: Jim Harrison <jim@xxxxxxxxxxxx>
  • To: "[ISAserver.org Discussion List]" <isalist@xxxxxxxxxxxxx>
  • Date: Sun, 16 May 2004 17:41:18 -0700

Yeh; I save the new ISAInfo to the current user's desktop.
Waddayasay; does that sound good for the current ISAInfo, too?

  Jim Harrison
  MCP(NT4, W2K), A+, Network+, PCG
  http://isaserver.org/Jim_Harrison/
  http://isatools.org
  Read the help / books / articles!


On Sun, 16 May 2004 17:01:09 -0700
 "cismic" <cismic@xxxxxxx> wrote:
http://www.ISAserver.org

I like saving my out put to the current users "My Documents Folder"
Look at my scripts for importing isa logs out on http://isatools.org.  Under
Joseph Kravis.
I utilize a method
for finding the "My Documents" folder and then writing processing logs to
that folder
I also use a method for utilizing writing errors to the current machines
application log
and also writing those errors out the the processing log.  Me, I like
looking at a process
log to see what steps happend. When we just use wcript.echo and forget to
capture
the screen or dialog boxes we could miss something.  My method of processing
errors allows us to quit a running script after each error is found.

Thank you,
Joseph
'Global Variables
Dim gObjFSO, gDailyLogRun, gWshshell , gProvider, gLocalMachine,
strLineInput(27),strProcessDir, strProcessedQueue, gstrMyDocuments

'***
' Local Module Variables and constants
'***
dim strComputerName, strDate, strDailyRunName

Set gWshshell = Wscript.CreateObject("Wscript.Shell")

'***
' Get the computer name from the environment varialbes where this script ran
'***
strComputerName = gWshshell.ExpandEnvironmentStrings("%COMPUTERNAME%")
gLocalMachine = strComputerName

'***
' get the local computer my documents folder for saving daily run logs
'***
gstrMyDocuments = gWshshell.SpecialFolders("MyDocuments")

'***
'Convert the / and : to "_" from the generated string
'***
strDate = Replace(Now, "/", "")
strDate = Replace(strDate, ":", "_")
'***
' Establish daily run log
'***
strDailyRunName = strComputerName & "_" & PROCESS_RUN_NAME & "_" & strDate &
PROCESS_RUN_EXTENTION
Set gDailyLogRun = gObjFSO.OpentextFile(gstrMyDocuments  & "\" &
strDailyRunName , ForWriting, True)


'***
' TODO::Add write to event log of the machine where this script ran
'***
gWshshell.LogEvent LOG_INFORMATION, "File Created Successfully " &
strDailyRunName

Dim argsNamed, argsUnnamed
Set argsNamed = Wscript.Arguments.Named
Set argsUnnamed = Wscript.Arguments.Unnamed

gProvider =  argsUnnamed(0)

----- Original Message ----- 
From: "Steve Moffat" <steve@xxxxxxxxxxxxxxxxxxxxxxxxxx>
To: "[ISAserver.org Discussion List]" <isalist@xxxxxxxxxxxxx>
Sent: Sunday, May 16, 2004 2:04 PM
Subject: [isalist] Re: Idea for ISA Blocking Scripts on isatools.org


http://www.ISAserver.org

can't the output from isainfo be saved to the c:\isainfo dir instead of
the isa dir.

S

-----Original Message-----
From: Jim Harrison [mailto:jim@xxxxxxxxxxxx]
Sent: Sunday, May 16, 2004 6:05 PM
To: Isa Weblist
Subject: [isalist] Re: Idea for ISA Blocking Scripts on isatools.org

http://www.ISAserver.org

Hi Joseph,

The problem with that technique is that all you get is an instance of
the  scripting engine.  What's needed is information about the script
it's running.

Unfortunately, WMI can't tell your what script is running within the
engine process, so my scripts could very well fail to run if another
unrelated script is operating.

  Jim Harrison
  MCP(NT4, W2K), A+, Network+, PCG
  http://isaserver.org/Jim_Harrison/
  http://isatools.org
  Read the help / books / articles!


On Sun, 16 May 2004 12:57:14 -0700
 "cismic" <cismic@xxxxxxx> wrote:
http://www.ISAserver.org

Hi there,
I disagree.  You can do effect monitoring of running instances of
wscript.exe.
So, if you add something like this to the start of your scripts then you
can effectively monitor and close out running the  script again.
However, it dosen't work so well if you have tons of wscript.echo
commands running during the processing and while you answer those start
the script again when the last wscript.echo was hit.

Option Explicit

Stop
On error Resume Next

Dim gstrUser,gstrDomain, gwshShell, gstrUserName, gLocal, gLocalService,
gobjProcessList, gProcess, lRetValue,  gProgram

Set oArgs =WScript.Arguments
set gLocal = createObject("WbemScripting.SWbemLocator")
Set gwshShell = CreateObject("Wscript.Shell")

gProgram = "wscript.exe" 'needs to be lower case the system "proc.name"
sends it this way.

ggstrUserName = gwshShell.ExpandEnvironmentStrings("%Username%")
gLocal.security_.impersonationLevel = 3 'impersonate

set gLocalService = gLocal.connectServer(".","root\cimv2")
set gobjProcessList = gLocalService.ExecQuery("Select * from
Win32_Process")

for each gProcess in gobjProcessList
 lRetValue = gProcess.GetOwner(gstrUser,gstrDomain)

 If gProcess.name = gProgram then
      MsgBox gProgram & " Is already running you cannot open another
instance ",vbexclamation,"Warning"
      WScript.quit
 End If

NEXT

Thank you,

Joseph



----- Original Message -----
From: "Jim Harrison" <jim@xxxxxxxxxxxx>
To: "[ISAserver.org Discussion List]" <isalist@xxxxxxxxxxxxx>
Sent: Sunday, May 16, 2004 8:19 AM
Subject: [isalist] Re: Idea for ISA Blocking Scripts on isatools.org


http://www.ISAserver.org

I thought about something like that, but it creates a potential "race"
condition where the file might not yet be created when a later script
runs.
This could actually cause both scripts to fail, leaving you even more
confused...
Plus, depending on how the scripts fail, the file may not get cleaned up
and
the system becomes more cluttered.

VB Scripting has some really bad error handling, but I use it because
it's
easier for most folks to read...

  Jim Harrison
  MCP(NT4, W2K), A+, Network+, PCG
  http://isaserver.org/Jim_Harrison/
  http://isatools.org
  Read the help / books / articles!


On Mon, 17 May 2004 02:40:22 +1200
 "Surago Jones" <surago@xxxxxxxxxxxx> wrote:
http://www.ISAserver.org

Ah Sweet. :)

One possibility to detect if the script it already running, would be to
create a temporary file at the beginning of the script, then remove it
at
the end of the script, and use a check to see if it exists before
continuing
within the script. :)  (not sure if that is possible, but an idea at
least.
:) )

heh, Tho i guess i should just be a little more careful with my
keypresses.
:)

Cheers

Surago Jones

-----Original Message-----
From: Jim Harrison [mailto:jim@xxxxxxxxxxxx]
Sent: Friday, 14 May 2004 04:03
To: [ISAserver.org Discussion List]
Subject: [isalist] Re: Idea for ISA Blocking Scripts on isatools.org



http://www.ISAserver.org

Actually, you do have a valid bug, just not the one you think...

You get popup-after-popup when you run them because:
1. the default scripting engine in Windows is WScript (popups for every
message)
2. not everyone knows (how) to change the default scripting engine to
CScript (console output).

Unfortunately, there's no way for a script to know if there is more than
one
instance of itself (HTA does, though).
Fortunately, the fix is to make the script(s) aware of the scripting
engine
that ran them and adjust accordingly.

That's a completely brain-dead change (ISAInfo does it already) that you
can
look for by this weekend.
Thanks for the bug report!

in the meantime, open a cmd window and type:
    cscript //h:cscript

now all scripts will run as console apps, not windows.

 Jim Harrison
 MCP(NT4, W2K), A+, Network+, PCG
  http://www.microsoft.com/isaserver
  http://isaserver.org/Jim_Harrison
  http://isatools.org

 Read the help, books and articles!
----- Original Message -----
From: "Surago Jones" <surago@xxxxxxxxxxxx>
To: "[ISAserver.org Discussion List]" <isalist@xxxxxxxxxxxxx>
Sent: Thursday, May 13, 2004 06:59
Subject: [isalist] Idea for ISA Blocking Scripts on isatools.org


http://www.ISAserver.org

Hi All,

I can't remember whom it was that developed the virus blocking scripts
on
ISATools.org, however i have a suggestion.

Would it be possible to have the script stop it from running again if it
has
already been started.  As i was running the MyDoom
script which creates quite a few Protocol Rules, unfortunately i got a
tad
carried away with hitting the enter key to all the
prompts that appear, and somehow managed to get it to run several copies
of
the script at the same time. :)  (Yep i'm a dumbass)

Anyways, just thought this idea would improve the script if the author
can
be bothered. :)

Cheers

Surago Jones


------------------------------------------------------
List Archives: http://www.webelists.com/cgi/lyris.pl?enter=isalist
ISA Server Newsletter: http://www.isaserver.org/pages/newsletter.asp
ISA Server FAQ: http://www.isaserver.org/pages/larticle.asp?type=FAQ
------------------------------------------------------
Other Internet Software Marketing Sites:
Leading Network Software Directory: http://www.serverfiles.com
No.1 Exchange Server Resource Site: http://www.msexchange.org
Windows Security Resource Site: http://www.windowsecurity.com/
Network Security Library: http://www.secinf.net/
Windows 2000/NT Fax Solutions: http://www.ntfaxfaq.com
------------------------------------------------------
You are currently subscribed to this ISAserver.org Discussion List as:
jim@xxxxxxxxxxxx
To unsubscribe send a blank email to $subst('Email.Unsub')


------------------------------------------------------
List Archives: http://www.webelists.com/cgi/lyris.pl?enter=isalist
ISA Server Newsletter: http://www.isaserver.org/pages/newsletter.asp
ISA Server FAQ: http://www.isaserver.org/pages/larticle.asp?type=FAQ
------------------------------------------------------
Other Internet Software Marketing Sites:
Leading Network Software Directory: http://www.serverfiles.com
No.1 Exchange Server Resource Site: http://www.msexchange.org
Windows Security Resource Site: http://www.windowsecurity.com/
Network Security Library: http://www.secinf.net/
Windows 2000/NT Fax Solutions: http://www.ntfaxfaq.com
------------------------------------------------------
You are currently subscribed to this ISAserver.org Discussion List as:
surago@xxxxxxxxxxxx
To unsubscribe send a blank email to $subst('Email.Unsub')





------------------------------------------------------
List Archives: http://www.webelists.com/cgi/lyris.pl?enter=isalist
ISA Server Newsletter: http://www.isaserver.org/pages/newsletter.asp
ISA Server FAQ: http://www.isaserver.org/pages/larticle.asp?type=FAQ
------------------------------------------------------
Other Internet Software Marketing Sites:
Leading Network Software Directory: http://www.serverfiles.com
No.1 Exchange Server Resource Site: http://www.msexchange.org
Windows Security Resource Site: http://www.windowsecurity.com/
Network Security Library: http://www.secinf.net/
Windows 2000/NT Fax Solutions: http://www.ntfaxfaq.com
------------------------------------------------------
You are currently subscribed to this ISAserver.org Discussion List as:
jim@xxxxxxxxxxxx
To unsubscribe send a blank email to $subst('Email.Unsub')

------------------------------------------------------
List Archives: http://www.webelists.com/cgi/lyris.pl?enter=isalist
ISA Server Newsletter: http://www.isaserver.org/pages/newsletter.asp
ISA Server FAQ: http://www.isaserver.org/pages/larticle.asp?type=FAQ
------------------------------------------------------
Other Internet Software Marketing Sites:
Leading Network Software Directory: http://www.serverfiles.com
No.1 Exchange Server Resource Site: http://www.msexchange.org
Windows Security Resource Site: http://www.windowsecurity.com/
Network Security Library: http://www.secinf.net/
Windows 2000/NT Fax Solutions: http://www.ntfaxfaq.com
------------------------------------------------------
You are currently subscribed to this ISAserver.org Discussion List as:
cismic@xxxxxxx
To unsubscribe send a blank email to $subst('Email.Unsub')

------------------------------------------------------
List Archives: http://www.webelists.com/cgi/lyris.pl?enter=isalist
ISA Server Newsletter: http://www.isaserver.org/pages/newsletter.asp
ISA Server FAQ: http://www.isaserver.org/pages/larticle.asp?type=FAQ
------------------------------------------------------
Other Internet Software Marketing Sites:
Leading Network Software Directory: http://www.serverfiles.com
No.1 Exchange Server Resource Site: http://www.msexchange.org
Windows Security Resource Site: http://www.windowsecurity.com/
Network Security Library: http://www.secinf.net/
Windows 2000/NT Fax Solutions: http://www.ntfaxfaq.com
------------------------------------------------------
You are currently subscribed to this ISAserver.org Discussion List as:
jim@xxxxxxxxxxxx
To unsubscribe send a blank email to $subst('Email.Unsub')

------------------------------------------------------
List Archives: http://www.webelists.com/cgi/lyris.pl?enter=isalist
ISA Server Newsletter: http://www.isaserver.org/pages/newsletter.asp
ISA Server FAQ: http://www.isaserver.org/pages/larticle.asp?type=FAQ
------------------------------------------------------
Other Internet Software Marketing Sites:
Leading Network Software Directory: http://www.serverfiles.com
No.1 Exchange Server Resource Site: http://www.msexchange.org
Windows Security Resource Site: http://www.windowsecurity.com/
Network Security Library: http://www.secinf.net/
Windows 2000/NT Fax Solutions: http://www.ntfaxfaq.com
------------------------------------------------------
You are currently subscribed to this ISAserver.org Discussion List as:
steve@xxxxxxxxxxxxxxxxxxxxxxxxxx
To unsubscribe send a blank email to $subst('Email.Unsub')



This E-Mail is confidential. It is not intended to be read, copied,
disclosed or used by any person other than the recipient named above.


Unauthorised use, disclosure, or copying is strictly prohibited and may be
unlawful. Optimum IT Solutions disclaims any liability for any action taken
in connection of this E-Mail. The comments or statements expressed in this
E-Mail are not necessarily those of Optimum IT Solutions or its subsidiaries
or affiliates.

administrator@xxxxxxxxxxxxxxxxxxxxxxxxxx



------------------------------------------------------
List Archives: http://www.webelists.com/cgi/lyris.pl?enter=isalist
ISA Server Newsletter: http://www.isaserver.org/pages/newsletter.asp
ISA Server FAQ: http://www.isaserver.org/pages/larticle.asp?type=FAQ
------------------------------------------------------
Other Internet Software Marketing Sites:
Leading Network Software Directory: http://www.serverfiles.com
No.1 Exchange Server Resource Site: http://www.msexchange.org
Windows Security Resource Site: http://www.windowsecurity.com/
Network Security Library: http://www.secinf.net/
Windows 2000/NT Fax Solutions: http://www.ntfaxfaq.com
------------------------------------------------------
You are currently subscribed to this ISAserver.org Discussion List as:
cismic@xxxxxxx
To unsubscribe send a blank email to $subst('Email.Unsub')

------------------------------------------------------
List Archives: http://www.webelists.com/cgi/lyris.pl?enter=isalist
ISA Server Newsletter: http://www.isaserver.org/pages/newsletter.asp
ISA Server FAQ: http://www.isaserver.org/pages/larticle.asp?type=FAQ
------------------------------------------------------
Other Internet Software Marketing Sites:
Leading Network Software Directory: http://www.serverfiles.com
No.1 Exchange Server Resource Site: http://www.msexchange.org
Windows Security Resource Site: http://www.windowsecurity.com/
Network Security Library: http://www.secinf.net/
Windows 2000/NT Fax Solutions: http://www.ntfaxfaq.com
------------------------------------------------------
You are currently subscribed to this ISAserver.org Discussion List as: 
jim@xxxxxxxxxxxx
To unsubscribe send a blank email to $subst('Email.Unsub')


Other related posts: