Share this post

Link to post

Share on other sites

Authenticity 12

Authenticity 12

Isn't "Extensions" is a sub-key and not a value name? I believe you're reading a "(value not set)" REG_SZ value which might be just a zero length string. First confirm that the RegRead successfully read the value of the desired value name.

Share this post

Link to post

Share on other sites

mdwerne 3

mdwerne 3

Isn't "Extensions" is a sub-key and not a value name? I believe you're reading a "(value not set)" REG_SZ value which might be just a zero length string. First confirm that the RegRead successfully read the value of the desired value name.

Yep, your correct. Here is a modified version...but I still have the syntax very wrong. I have a very tough time with regular expressions.

Share this post

Link to post

Share on other sites

Authenticity 12

Authenticity 12

I can't really be of help if I don't know the content of the value name so what I do know is that you're telling the regex to check whether there is "Symantec" followed by a space " " and contains at least 1 digit after that...

If you can give an example for a value name's value it'll help.

Share this post

Link to post

Share on other sites

mdwerne 3

mdwerne 3

Sorry I'm not being clear enough. Instead of searching for the specific Symantec entry "Symantec Antivirus" (the value data makes no difference) I would like to find any value that contains the word "Symantec " and delete the whole value with its data.

Does this help?

As you can see in my first code box, I'm looking for each of my five Symantec names individually...I'm trying to change my code to loop through the key deleting each of the five, using some "Symantec *" wildcard.

How can I do what I'm already doing more efficiently?

That is my question.

Thanks for the help,

-Mike

P.S. The "value data" of those values is a path to a dll that is fighting with the install of another application when Outlook runs.

Share this post

Link to post

Share on other sites

Archie 0

Archie 0

I know that this thread is pretty old but i really hope someone picks up on it. I have been using AutoIT for a couple of years now but only in a very basic form (to automatically install software). I have now been given the task to regularly check when our Windows 2000 and 2003 servers have last had their windows updates installed on them (no, we don't have a WSUS server). The way i plan on doing this is by quering the registry to find the "last installed" update. What i want to do is write a query that searches the HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\ part of the registry for anything beginning with KB. Once i have those results, search the registry (above mentioned results) for the string values of "InstallDate" and ultimatley end up with the latest date. I know this seems like a long winded way but as i said, its part of a script that runs this task (along with a regread to show OS version and SP level) on 14 MS servers. Any help on this would be really appreciated.

Share this post

Link to post

Share on other sites

Archie 0

Archie 0

Thanks for the speedy reply. I just wanted to ask a couple of questions first (and please excuse my ignorance). What is an Object in AutoIT and how can i interact with it. The other thing i wanted to ask was, how would i get the results from your script to "print to a file". While i dont need the full windows update history for what i want to achieve, i do have to have it. The only data i want to print to the file is along the lines of "Server X was last updated on dd/mm/yyyy" and possible the name (or KB number) of the last installed update.

My script works in the following way:

I have a file called server_list.ini

In there, i have section 1 with the key value = to server 1, section 2 with the key value of server 2, etc etc

My script reads the .ini file and runs a DriveMapAdd to the \ipc$ for each server (in order to authenticate using $username and $password variables taken from an InputBox ) and then performs a reg read to check OS ver and SP level (on each server).

It does the above for 14 servers and writes the regread results to a file.

Share this post

Link to post

Share on other sites

zorphnog 8

zorphnog 8

An object in AutoIt is a COM reference http://www.autoitscript.com/autoit3/docs/intro/ComRef.htm. A reference to a COM object allows you to get/set properties and perform it's methods. These properties and methods are unique to each COM object and you must refer to the COM API in order understand how to access and use the object. For this example I used a Windows Update Agent (WUA) API http://msdn.microsoft.com/en-us/library/aa387292%28VS.85%29.aspx. I'm not sure how familiar you are with AutoIt, but COM interfaces are a bit more complex than normal functions in AutoIt so it's not something that can be picked up easily.

As far as making the results print to file, that's pretty simple. You can specify the servername/IP and authentication information in the ObjCreate function. I would store all your connection information (Servername/IP, Username, Password) in an array and then loop through the array for each connection to get the information. So something like this should do the trick.

$sIniFile="C:\server_list.ini "$aSections=IniReadSectionNames($sIniFile)If@errorThenMsgBox(16,"ERROR","Cannot read ini file")ExitEndIfDim$aConnection[$aSections[0]][3]; Create array for connection data$hOutfile=FileOpen("C:\ServerUpdates.txt",2); Open new file in write modeFor$i=0To$aSections[0]-1$aConnection[$i][0]=IniRead($sIniFile,$aSections[$i+1],"server",0); Get servername/IP$aConnection[$i][1]=InputBox($aConnection[$i][0],"Enter username:",""); Get username$aConnection[$i][2]=InputBox($aConnection[$i][0],"Enter password:","","*"); Get password; Enter code for ipc connection and registry reads here; Get update information$oSession=ObjCreate("Microsoft.Update.Session",$aConnection[$i][0],$aConnection[$i][1],$aConnection[$i][2])If@errorThenMsgBox(16,"ERROR","Error creating session for "&$aConnection[$i][0])ContinueLoopEndIf$oSearcher=$oSession.CreateUpdateSearcher()$oHistoryColl=$oSearcher.QueryHistory(0,1)For$iHistoryIn$oHistoryColl; Write last update time and title to fileFileWriteLine($hOutfile,"Server ["&$aConnection[$i][0]&"] was updated on "&_StringRegExpReplace($iHistory.Date,"([0-9]{4})([0-9]{2})([0-9]{2})([0-9]{2})([0-9]{2})([0-9]{2})","\1/\2/\3 \4:\5:\6")&_" ["&$iHistory.Title&"]")Next$oSession=0$oSearcher=0$oHistoryColl=0NextFileClose($hOutfile)

Edited May 21, 2010 by zorphnog

Share this post

Link to post

Share on other sites

Archie 0

Archie 0

Thanks for everything. So far this is what i have and most of it works but there are still some major glitches. The 1st problem i have is that for some reason, i can not pass through the admin user name and password properly (unless i am logged onto a machine with exactly the same username and password. The other problem i have is, if i connect to a server that has never had a windows update done on it, the entire script stops. I would like to have some sort of "this server has never been updated" report written to the history.txt file, and then continue through the ini file (getting update info from the other servers.

Like i said, i am pretty stumped here and about to give up on the whole thing all together so any advice would be appriciated.

Share this post

Link to post

Share on other sites

Archie 0

Archie 0

Ok, I have pretty got everything i want in the script now. The only problem i still have are: If any server has never been updated, the entire scripts stops at that point. The other problem is, if i am not logged onto a machine with exactly the same username and password that the servers have, the objcreate fails. For some reason, the $username and $password dont seem to get passed through (Even though a quick glance at net use shows a mapping to the IPC$ of each server.

Here is what i have working at the moment (without $username and $password).