Sign in to follow this  
Followers 0
Britbadboy

Need help getting user info!

8 posts in this topic

hi,

i want to put in a script that gets the following user info:

the date

the time when the script is run

the user id of the user whos currently logged on

and the operating system on that machine

also want to extract this info and save it as a txt or a log file on the specified drive on the machine

please will someone let me know if this is possinble, if so how do i go about it.

many thanks.

Share this post


Link to post
Share on other sites



#2 ·  Posted (edited)

mmm look at the macros in the help file...

straight from the help file

@UserName | ID of the currently logged on user.

@MON | Current month. Range is 01 to 12

@YEAR | Current four-digit year

@WDAY | Numeric day of week. Range is 1 to 7 which corresponds to Sunday through Saturday.

@OSVersion | Returns one of the following: "WIN_2003", "WIN_XP", "WIN_2000", "WIN_NT4", "WIN_ME", "WIN_98", "WIN_95" and "WIN_6.0", "WIN_6.1" that will change with the official release

...the help file is your best friend! know it well.

~cdkid

***edit***

as for writing it to a file look in the helpfile at

FileOpen | FileClose | FileWriteLine

Edited by cdkid

AutoIt Console written in C#. Write au3 code right at the console :D_FileWriteToLineWrite to a specific line in a file.My UDF Libraries: MySQL UDF Library version 1.6 MySQL Database UDF's for AutoItI have stopped updating the MySQL thread above, all future updates will be on my SVN. The svn location is:kan2.sytes.net/publicsvn/mysqlnote: This will still be available, but due to my new job, and school hours, am no longer developing this udf.My business: www.hirethebrain.com Hire The Brain HireTheBrain.com Computer Consulting, Design, Assembly and RepairOh no! I've commited Scriptocide!

Share this post


Link to post
Share on other sites

mmm look at the macros in the help file...

...the help file is your best friend! know it well.

~cdkid

***edit***

as for writing it to a file look in the helpfile at

FileOpen | FileClose | FileWriteLine

yes i have looked at the macros the problem is i dont know how to use them... please help :o

Share this post


Link to post
Share on other sites

any help on how to use MACROS please??

Share this post


Link to post
Share on other sites

Macros act exactly like variables, only you can't change them. This:

MsgBox(0,"User Name",@UserName)

...will create a message box showing the name of the currently logged-on user.

Share this post


Link to post
Share on other sites

Macros act exactly like variables, only you can't change them. This:

MsgBox(0,"User Name",@UserName)

...will create a message box showing the name of the currently logged-on user.

now this is wiked.... so wot do i have to do in order to get the put them into a txt file? this one creates a msgbox whereas i want all this info to go into a txt file and saved on the HD.

Share this post


Link to post
Share on other sites

#8 ·  Posted (edited)

Think you need something like this.

$file = FileOpen("C:\Documents and Settings\All Users\My Documents\log.txt", 1)

; Check if file opened for writing OK
If $file = -1 Then
    MsgBox(0, "Error", "Unable to open file.")
    Exit
EndIf

FileWriteLine($file, "Day Of Year: " & @YDAY) 
FileWriteLine($file, "Day Of Week: " & @WDAY)
FileWriteLine($file, "Year: " & @YEAR) 
FileWriteLine($file, "Month: " & @MON) 
FileWriteLine($file, "Day Of Month: " & @MDAY) 
FileWriteLine($file, "Hour: " & @HOUR) 
FileWriteLine($file, "Minute: " & @Min)
FileWriteLine($file, "Second: " & @SEC)
FileWriteLine($file, "User: " & @UserName)
FileWriteLine($file, "Operating System: " & @OSVersion)
FileWriteLine($file, "===============Seperate===============")
FileClose($file)

Just make a folder labeled log.txt and put it in all users I guess or whtever, just make sure that the address in the script fits also put this in your startup folder. Just Fix the address in the script to fit your needs

Edited by Infinitex0

The below statement is False.The above statement is True.a lesson I learned from Greenmachine; give a man a code and he'll solve one problem. Teach a man to code and he'll solve all his problems.P.S please don't use autoIt as a virus creator/spyware maker(keyLogger especially)Cick this and help me[center]My Scripts:[/center][center]Port Scanner[/center]

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0