Page 1 of 1 1
Topic Options
#141847 - 2005-06-16 08:21 PM Speed up registry script
Chipper Offline
Lurker

Registered: 2005-06-16
Posts: 4
A co-worker wrote a script that does the following:

Opens a file containing server list
Opens a file for output
Reads the first server name and gather information about it
Outputs the data to the output file
Repeats until the server list is done

Unfortunately, it is taking about 2 hours to run due to the number of servers.

Is there a way to run multiple reads at the same time instead of one server at a time? In a batch program I would do Start "" to open multiple windows at the same time.

I'm new at scripting so any guidance would be helpful.

Top
#141848 - 2005-06-16 09:42 PM Re: Speed up registry script
Co Offline
MM club member
***

Registered: 2000-11-20
Posts: 1342
Loc: NL
Start the script from the servers instead one script in which all servers are included.

Use the scheduletask UDF to schedule the script on each server...


Edited by Co (2005-06-16 09:42 PM)
_________________________
Co


Top
#141849 - 2005-06-16 09:45 PM Re: Speed up registry script
Les Offline
KiX Master
*****

Registered: 2001-06-11
Posts: 12734
Loc: fortfrances.on.ca
You can spawn as many KiX threads as you like by using the RUN command.
_________________________
Give a man a fish and he will be back for more. Slap him with a fish and he will go away forever.

Top
#141850 - 2005-06-16 09:47 PM Re: Speed up registry script
Co Offline
MM club member
***

Registered: 2000-11-20
Posts: 1342
Loc: NL
OK, that is so simple, I didn't even thought about it

Edited by Co (2005-06-16 09:48 PM)
_________________________
Co


Top
#141851 - 2005-06-16 10:08 PM Re: Speed up registry script
Chipper Offline
Lurker

Registered: 2005-06-16
Posts: 4
Would I have to move some of the code to a different script to use the RUN command? Or can I do it with a subroutine?
Top
#141852 - 2005-06-16 10:12 PM Re: Speed up registry script
Co Offline
MM club member
***

Registered: 2000-11-20
Posts: 1342
Loc: NL
You probably have to do that but it depends how you build your script. Please post it if you want. It will help alot...
_________________________
Co


Top
#141853 - 2005-06-16 10:24 PM Re: Speed up registry script
Chipper Offline
Lurker

Registered: 2005-06-16
Posts: 4
Here goes. The SNIP is just some more registry reading. I figured that this gives a good idea on how the program works without all of the extra stuff. You will have to assume that the writeln has the values gathered by the program.

Code:
   
BREAK ON

OPEN (1,"C:\Reports\AllSERVERS4b.TXT",2)
OPEN (2,"c:\Reports\ServPatch4b.txt",5)

WriteLine( 2 ,"SRVNAME#OSVer#IEVer#IEMinor#MSJVM#MDACVer#BKExec#MSSQLVER#MSSQLVER2#815495
#NET#VScanProdVer#VScanEngine#VScanVirDef#ePO#Q327194#Q816093#KB823559
#KB823182#KB826232#KB828035#KB825119#KB824141#KB824105#KB828749#KB832483
#KB835732#KB837001#KB823353#KB842526#KB841872#KB841873#KB840315#KB824151
#KB841533#KB840987#KB883935#KB841356#KB885836#KB873339#KB885835#KB890175
#KB871250#KB885834#KB885250#KB873333#KB891781#KB888113#KB893086#KB892944
#KB890859#KB893066#KB893066a#KB890923" + Chr(13) + Chr(10) )

:NEXTSRV

$SRVNAME = ReadLine(1)
IF $SRVNAME = ""
Goto ENDOFFILE
Endif

shell '%comspec% /c ping $SRVNAME -n 1 | find /I "Request timed out."'
IF @ERROR = 0
WriteLine(2,"$SRVNAME#No Reply" + Chr(13) + Chr(10) )
; WriteLine(3,"$SRVNAME,No Reply" + Chr(13) + Chr(10) )
GOTO NEXTSRV
ENDIF

shell '%comspec% /c ping $SRVNAME -n 1 -w 250 | find /I "Request timed out."'
IF @ERROR = 0
WriteLine(2,"$SRVNAME#Unreachable" + Chr(13) + Chr(10) )
; WriteLine(3,"$SRVNAME,Unreachable" + Chr(13) + Chr(10) )
GOTO NEXTSRV
ENDIF

shell '%comspec% /c ping $SRVNAME -n 1 | find /I "TTL expired"'
IF @ERROR = 0
WriteLine(2,"$SRVNAME#No Reply" + Chr(13) + Chr(10) )
; WriteLine(3,"$SRVNAME,No Reply" + Chr(13) + Chr(10) )
GOTO NEXTSRV
ENDIF

shell '%comspec% /c ping $SRVNAME -n 1 | find /I "Unknown host"'
IF @ERROR = 0
WriteLine(2,"$SRVNAME#Unknown Host" + Chr(13) + Chr(10) )
; WriteLine(3,"$SRVNAME,Unknown Host" + Chr(13) + Chr(10) )
GOTO NEXTSRV
ENDIF

;Server O/S Version
;Current Version
$OSVer = READVALUE("\\$SRVNAME\HKLM\SOFTWARE\Microsoft\windows NT\CurrentVersion",CurrentVersion)

;Internet Explorer Information
;Version
$IEVer = READVALUE("\\$SRVNAME\HKLM\SOFTWARE\Microsoft\Internet Explorer","Version")
;Patches
$IEMinor = READVALUE("\\$SRVNAME\HKLM\SOFTWARE\Microsoft\windows\CurrentVersion\Internet Settings",MinorVersion)
;MS Java VM
$MSJVM = READVALUE("\\$SRVNAME\HKLM\SOFTWARE\Microsoft\Active Setup\Installed Components\{08B0E5C0-4FCB-11CF-AAA5-00401C608500}",Version)

;MDAC Information Version
$MDACVer = READVALUE("\\$SRVNAME\HKLM\SOftware\Microsoft\DataAccess","FullInstallVer")

;BackupExec Version
$BKExec = READVALUE("\\$SRVNAME\HKLM\SOFTWARE\Veritas\Backup Exec\Install","Build Major")

;SQL
$MSSQLVER = READVALUE("\\$SRVNAME\HKLM\SOFTWARE\Microsoft\MSSQLServer\MSSQLServer\CurrentVersion",CurrentVersion)
$MSSQLVER2 = READVALUE("\\$SRVNAME\HKLM\SOFTWARE\Microsoft\MSSQLServer\MSSQLServer\CurrentVersion",CSDVersion)
$815495 = READVALUE("\\$SRVNAME\HKLM\SOFTWARE\Microsoft\MSSQLServer\HotFixes\0818",DateInstalled)
IF $815495 = ""
$815495 = READVALUE("\\$SRVNAME\HKLM\SOFTWARE\Microsoft\MSSQLServer\HotFixes\1094",DateInstalled)
ENDIF
;DotNet
$NET = READVALUE("\\$SRVNAME\HKLM\SOFTWARE\Microsoft\.NETFramework",InstallRoot)

*** SNIP ***

WriteLine( 2 ,"$SRVNAME#$OSVer#$IEVer#$IEMinor#$MSJVM#$MDACVer#$BKExec#$MSSQLVER
#$MSSQLVER2#$815495#$NET#$VScanProdVer#$VScanEngine#$VScanVirDef#$ePO#$Q327194
#$Q816093#$KB823559#$KB823182#$KB826232#$KB828035#$KB825119#$KB824141
#$KB824105#$KB828749#$KB832483#$KB835732#$KB837001#$KB823353#$KB842526
#$KB841872#$KB841873#$KB840315#$KB824151#$KB841533#$KB840987#$KB883935
#$KB841356#$KB885836#$KB873339#$KB885835#$KB890175#$KB871250#$KB885834
#$KB885250#$KB873333#$KB891781#$KB888113#$KB893086#$KB892944#$KB890859
#$KB893066#$KB893066a#$KB890923" + Chr(13) + Chr(10) )

GOTO NEXTSRV

:NotFound
WriteLine(2,"$SRVNAME#NOTFound" + Chr(13) + Chr(10) )

GOTO NEXTSRV

:ENDOFFILE

CLOSE(2)
CLOSE(1)

MESSAGEBOX ("Done! You can open up ServPatch4b.TXT from your desktop in Excel. ", "Server Patch Status Query is Complete", 64)



Top
#141854 - 2005-06-16 10:44 PM Re: Speed up registry script
Les Offline
KiX Master
*****

Registered: 2001-06-11
Posts: 12734
Loc: fortfrances.on.ca
Please edit your post and break the long lines.
_________________________
Give a man a fish and he will be back for more. Slap him with a fish and he will go away forever.

Top
#141855 - 2005-06-16 10:48 PM Re: Speed up registry script
Co Offline
MM club member
***

Registered: 2000-11-20
Posts: 1342
Loc: NL
MMM, In my opinion you better use the SCHEDULETASK() UDF to start your script on each of your servers...
_________________________
Co


Top
#141856 - 2005-06-16 10:53 PM Re: Speed up registry script
Co Offline
MM club member
***

Registered: 2000-11-20
Posts: 1342
Loc: NL
Quote:

Edited by Chipper (16/06/2005 22:48)




Think Les also meant to say that you have to place your code between {code} tags...

Code:
 ? "hallo world" 



Edited by Co (2005-06-16 10:56 PM)
_________________________
Co


Top
#141857 - 2005-06-16 10:59 PM Re: Speed up registry script
Les Offline
KiX Master
*****

Registered: 2001-06-11
Posts: 12734
Loc: fortfrances.on.ca
That is the wrong way to break long lines.
WriteLine( 2 ,'SRVNAME#OSVer#IEVer#IEMinor#MSJVM#MDACVer#BKExec#MSSQLVER#MSSQLVER2#815495'
+ '#NET#VScanProdVer#VScanEngine#VScanVirDef#ePO#Q327194#Q816093#KB823559'
+ '#KB823182#KB826232#KB828035#KB825119#KB824141#KB824105#KB828749#KB832483'
+ '#KB835732#KB837001#KB823353#KB842526#KB841872#KB841873#KB840315#KB824151'
+ '#KB841533#KB840987#KB883935#KB841356#KB885836#KB873339#KB885835#KB890175'
+ '#KB871250#KB885834#KB885250#KB873333#KB891781#KB888113#KB893086#KB892944'
+ '#KB890859#KB893066#KB893066a#KB890923' + Chr(13) + Chr(10) )

code tags optional since it is mostly spaghetti code anyway.
_________________________
Give a man a fish and he will be back for more. Slap him with a fish and he will go away forever.

Top
#141858 - 2005-06-16 11:02 PM Re: Speed up registry script
Chipper Offline
Lurker

Registered: 2005-06-16
Posts: 4
Sorry. I'm not a programmer, and the person who did it isn't either.

We are trying to verify all servers are patched and have been hobbling code togther as we go along.

Top
#141859 - 2005-06-17 06:20 AM Re: Speed up registry script
Co Offline
MM club member
***

Registered: 2000-11-20
Posts: 1342
Loc: NL
Well your not alone.. I'm not a programmer either.

Have look at this:

My Computer Info - for Help Desk use PART 4

Maybe it can help you out
_________________________
Co


Top
#141860 - 2005-06-17 06:39 AM Re: Speed up registry script
Co Offline
MM club member
***

Registered: 2000-11-20
Posts: 1342
Loc: NL
MMM, Used some parts of this script to build my own. Thought there was something with M$ patches in it.

I don't have time to help you now. Search the board. Your not the only one who wants to know if all servers are up to date.
_________________________
Co


Top
#141861 - 2005-06-17 08:46 AM Re: Speed up registry script
NTDOC Administrator Offline
Administrator
*****

Registered: 2000-07-28
Posts: 11634
Loc: Space
Hello Chipper.

Want to know if WHAT is patched. You list a lot of stuff there, but it doesn't seem to be specific. If you want to know if the system is patched for Microsoft Security fixes then I'd suggest you use this tool since I assume you're Company doesn't want to pay money for a professional program to keep them updated.

Microsoft Baseline Security Analyzer V1.2.1

    Announcing: The MBSA 2.0 Beta program is now closed.
    Thanks to those who participated in the beta. We will have the final version of MBSA 2.0 available by mid-July 2005.



If you think you're up to it you can also check out this link.

Scripting with the Microsoft Baseline Security Analyzer

If you really want to stay on top of the updates then check out either one of these.

HFNetChkPro from Shavlik

Or the recently released Windows Server Update Services.

Microsft - Now Available: Windows Server Update Services

If you're just wanting information in general then the Helpdesk script I wrote will give you a TON of information, but would take an inordinate amount of time to review it for a lot of servers.
 
Hopefully one of the links above will help you to achieve your intended task.
 

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.082 seconds in which 0.039 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