NickBtheITguy Posted November 7, 2008 Posted November 7, 2008 In my script I am using _FileWriteLog to write log files. I want to be able to write them to a network share using a unc path. The only problem I am running into is that the share requires a login. I am not sure how to pass the credentials so that my script will write to the share. I saw the RunAs but I don't really understand how I could use that with _FileWriteLog.
dillonlim Posted November 7, 2008 Posted November 7, 2008 In my script I am using _FileWriteLog to write log files. I want to be able to write them to a network share using a unc path. The only problem I am running into is that the share requires a login. I am not sure how to pass the credentials so that my script will write to the share. I saw the RunAs but I don't really understand how I could use that with _FileWriteLog.Try passing this command in your script:net use \\<path of network share> /user:<login> <password>Downside to that is your password is unencrypted and can be seen in your script.
ProgAndy Posted November 7, 2008 Posted November 7, 2008 (edited) You could ask for the password each time the Script starts also, you can make the login persistent (type net use /? in you cmd for more information) Edited November 7, 2008 by ProgAndy *GERMAN* [note: you are not allowed to remove author / modified info from my UDFs]My UDFs:[_SetImageBinaryToCtrl] [_TaskDialog] [AutoItObject] [Animated GIF (GDI+)] [ClipPut for Image] [FreeImage] [GDI32 UDFs] [GDIPlus Progressbar] [Hotkey-Selector] [Multiline Inputbox] [MySQL without ODBC] [RichEdit UDFs] [SpeechAPI Example] [WinHTTP]UDFs included in AutoIt: FTP_Ex (as FTPEx), _WinAPI_SetLayeredWindowAttributes
udgeen Posted November 7, 2008 Posted November 7, 2008 Or use the same command on AutoIt. Its just the same as "net use", couse net.exe can be disabled by system administrator : ) DriveMapAdd ( "", "\\server\share", 0, "domain\username", "password" ) or DriveMapAdd ( "", "\\server\IPC$", 0, "domain\username", "password" ) - for windows file servers only the second variant is almost interesting, couse the share can be disabled while server is alive that'll let you to test the log file existance by FileExists("LogFileFullPath") before writing to it ...and if the logserver is far away (for example on the other side of vpn tunnel), its a good idea to test it by Ping() command first. The only problem is the same: password in your code... any ideas to write own syslog server for windows?
NickBtheITguy Posted November 7, 2008 Author Posted November 7, 2008 Thanks guys! You gave me some things to think about. I'm going to test a few of the methods and see which one I end up using.
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now