Jump to content

Writing The Value Of A Registry Key To A Text File


mbusse
 Share

Recommended Posts

Hello, I just recently was turned on to Autoit, what a beautiful thing, I found it easy to pick up, so I commend the author.

Ok, my question, I want to read the value of a registry key, say the operating system, machine name, and userid, then I want to pipe the value to a .txt file residing on a server. I will execute this in a logon script and want to log each logon and append the data to this .txt file and maybe add a comma delimiter after each value. Can this be done?

I know you can read a key with

regread,testkey,reg_sz,hkey_local_machine, software\\microsoft\\windows\\currentversion,version

now how do I pipe the input to a .txt file and if I want to grab 2 other keys and put them in the same line in a text file so I can open it in excel assuming comma delimited and view os version, machine name, username, all in the same line and keep appending each logon to the same text file.

I am really hoping this can be done.. Excitedly awaiting a response.. Thanks to all..

Happy scripting..

Link to comment
Share on other sites

Larry, thanks for the quick reply, Can I call any of the environment variables? This would be easier than a registry read. It has everything I am looking for. I guess I did not realize you could read the environment variables with Autoit..

If it works this is GREAT!!

Link to comment
Share on other sites

OK, I have one glitch, I need the information from win98 machines also, which do not have any of the environment variables I need, so I am back to reading the registry for it, so back to the original question of can I pipe the data to a .txt file? Thanks.

Link to comment
Share on other sites

We use this: BGInfo. (Sometimes) it won't make sense to reinvent the weel :whistle:

How many times have you walked up to a system in your office and needed to click through several diagnostic windows to remind yourself of important aspects of its configuration, such as its name, IP address, or operating system version? If you manage multiple computers you probably need BGInfo. It automatically displays relevant information about a Windows computer on the desktop's background, such as the computer name, IP address, service pack version, and more. You can edit any field as well as the font and background colors, and can place it in your startup folder so that it runs every boot, or even configure it to display as the background for the logon screen.

Because BGInfo simply writes a new desktop bitmap and exits you don't have to worry about it consuming system resources or interfering with other applications.

BgInfo works on 95 and higher, and Windows NT 4.0 and higher.

File|Database: Specifies a .XLS, .MDB or .TXT file or a connection string to an SQL database that BGInfo should use to store the information it generates. Use this to collect a history of one or more systems on your network. You must ensure that all systems that access the file have the same version of MDAC and JET database support installed. It is recommended you use at least MDAC 2.5 and JET 4.0. If specifying an XLS file the file must already exist.

If you prefer to have BGInfo update the database without modifying the user's wallpaper you can unselect all desktops in the Desktops dialog; BGInfo will still update the database.

We use it within our network, and it's brilliant! Freeware

Link to comment
Share on other sites

LAR, I am really close, all is working except, the output in the text file I am writing using the syntax you posted is giving me these results:

MO3440,bussem,Windows 98\nMO3440,bussem,Windows 98\n

2 questions..

1. why is the \n showing up

2. why I am I not starting a new line after the first Windows 98

So, here is how I want the results to look:

MO3440,bussem,Windows 98

MO3440,bussem,Windows 98

MO3440,bussem,Windows 98

MO3440,bussem,Windows 98

MO3440,bussem,Windows 98

MO3440,bussem,Windows 98

MO3440,bussem,Windows 98

Thanks again..

Link to comment
Share on other sites

regread,testkey4,REG_SZ,HKEY_LOCAL_MACHINE, SYSTEM\\CurrentControlSet\\Control\\ComputerName\\ComputerName,ComputerName

regread,testkey5,REG_SZ,HKEY_LOCAL_MACHINE, Network\\Logon,username

regread,testkey6,REG_SZ,HKEY_LOCAL_MACHINE, Software\\Microsoft\\Windows\\CurrentVersion,Version

FileAppend, %testkey4%\,%testkey5%\,%testkey6%\n,\\\\mywan\\sharevol\\share\\itupdates\\win98.txt

Link to comment
Share on other sites

Did you execute it multiple times to see if it would wrap, and not keep putting it on the same line?

I am assuming yes..

Man so close, I dunno, I have been staring at this for too long.. I just don't get it..

Thanks, Mark..

Link to comment
Share on other sites

  • Developers

yes i did... and your output file actually show the characters "\n" ????

Edited by JdeB

SciTE4AutoIt3 Full installer Download page   - Beta files       Read before posting     How to post scriptsource   Forum etiquette  Forum Rules 
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

Link to comment
Share on other sites

  • Developers

My apologies, I may have made a change and not recompiled, I have made so many changes today, I just recompiled what I posted and tried again, it is working fine..

Thanks much for all the help..

This is wonderful!!!!!

No problem.. it always helps when explaining a problem and you need to go back and re-think what youve done.. :whistle:

SciTE4AutoIt3 Full installer Download page   - Beta files       Read before posting     How to post scriptsource   Forum etiquette  Forum Rules 
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

Link to comment
Share on other sites

 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...