I was wondering though, can autoit make an executable that would setup a permanent drive map. Instead of a non-technical user mapping a drive, the executable file would setup a predefined mapped drive. That would be cool..
Thanks
Jim
Well, Jim, there are several different ways that you can map drives but two of the easiest are using a batch file or through AutoIt. Now I know that you can’t make a batch file into an executable but I thought that I would show you how todo this anyway.
Our Example
For this post, I want to use an example to help clarify these concepts. For our example, we would like to map drive letter T: to network share \\server\share.
Batch File
To map a drive in a batch file, simply use the net use command. So, for our example, we would use:
net use T: \\server\share
If you want the drive mapping to return each time you reboot, add the /persistent:yes option:
net use T: \\server\share /persistent:yes
AutoIt
In AutoIt, you use the DriveMapAdd command. Our example would look like this:
DriveMapAdd("T:","\\server\share")
To allow it to survive a reboot, add one more option:
DriveMapAdd("T:","\\server\share",8)
That’s all there is to it. You can then compile this into an executable and away you go!
Jeff is looking for antivirus software that he can run from his USB drive:
DO u know where i could find a usb antivirus program? I think something like that would be quite usefull for computers that can’t connect to the internet and such. I try’d looking on ur site to see if i could find one, but i could not. Any help would be great thx.
Well, Jeff, I took a quick look through some of my favorite portable application sites and I came up with the following list:
Brian has just finished reading HowTo Backup a Registry Key and wants to know how he can distinguish different registry keys apart.
Tim,
Again thanks for the great newsletter.
I am sure I am in the group of your least tech knowledgeable subscribers, and consequently, I patiently await each posting to see what new secrets I can learn from you.
For example, I have been making registry backup of the entire registry and when I read, “How To Backup a Registry Key”, I was amazed and excited to learned how to backup just the needed part of the registry!!
However, this causes a new issue: knowing exactly what the partial back up is.
When backing up the entire registry I would simply save the file as: RegBkUp07-03-01.reg and knew it would replace the entire registry as of that date.
Consequently, I know am wondering how to identify a partial back up .reg file.
The reg key file name would be to long to be used in the file name.
So I was thinking I could put a note in the file itself I could open the .reg file with notepad and reveal exactly what I had backed up.
Having read many other of your posting about scripting, I think this could probably be done quite easily, but I don’t know how to go about it.
So I am thinking that there are others out there that would appreciate a quick lesson on how to accomplish this. If so, you could add to, not only my knowledge, but also to some other readers.
Thanks for the great newsletter and sharing you knowledge with us.
Brian
Thanks for the kind praise, Brian.
As for your question, all of the information that you are looking for is already available. If you open up the REG file with a text editor such as Notepad, you will see that the registry key that you are backing up is in the third line. As for the date that it was created, if you right click on the REG file and click on Properties, you will see the date that the file was created.
While you are in the properties page, there is also a Summary tab. In there, you can put file meta data. This is information that is stored in the file system but is not a part of the file itself. This could be a really good place to store information about the REG file.
Another option for storing information is in the file itself. You can create a comment by opening up the REG file in a text editor. Then, you can create a new line that starts with a semicolon (;). Any line that starts with ; will be ignored by the registry program so you can put anything you want in that line.
Now, I have a small gift for the truly lazy. I have created RegInfo. This is a small utility that will allow you to select a registry file and tell you when the registry file was created and what registry key it backs up.
To use RegInfo, simply drop any REG file on it or double click on the program and browse to a REG file of your choosing.
Norm is new to Daily Cup of Tech and wants to know about the scripting language that I develop in. Norm writes:
I’m very interested in your creative and innovative use of scripts. Could you tell me what language you’re scripting in? I’m not familiar enough to identify what language it’s in.
Thank you!
Thanks for the e-mail, Norm. I have been enamored with AutoIt for many years now and I write pretty much everything exclusively in this scripting language. I used to be a big VBScript guy but switched over a while ago now.
There are several reasons that I use AutoIt as opposed to other languages:
It is freeware.
I am not a developer by trade and AutoIt allows me to create very useful scripts without much difficulty.
Unlike many other scripting languages, AutoIt can create self-contained executables that do not rely on other outside libraries or sources.
I can easily automate repetitive tasks including key presses and mouse movements.
Ryan sent an e-mail a few days ago with a problem between DeltaCopy and FreeNAS. It seems that everything copies just fine but then locks him out.
Hello,
I recently came across your website and I love it!!! I have a question about one of your articles that I was hoping you might be able to help me with (I understand that you not in the business of tech support..but hey). I went through your FreeNAS how to article and was, amazingly, able to get my system up and running relatively easily. But when I configure Rsync with Deltacopy, I run into a problem where I do not have “permission” to access the files that are automatically backed up to the FreeNas server. In other words, Rsync and Delta copy do their thing and seem to do it correctly, but when I try to access the files that have been backed up. I get network permission errors and file permission errors. Is this something that you came across when you tested this? I’m running Windows XP SP2, the latest Freenas, and a linksys router. Any information you can provide is greatly appreciated.
Again, very nice website.
Ryan.
First of all, Ryan, thanks for the kind works. I’m always glad to hear that people enjoy reading DCoT. Now, if only I could make money at it!
Now, for your technical request. The problem that you are having is with the file permissions that are set on the FreeNAS drive. By default, only the root account has access to these files.
Reset Permissions
There are two ways that you can solve this problem. The first is to change the permissions on all the files. This is a relatively easy process. Simply go to the Command section of the Diagnostics menu. Enter the following command:
where <sharename> is the name of the share that you wish to reset permissions on. For example, if your share name was Backup, you would execute the command:
This would reset the permissions on all of the files in the Backup share.
Click on the Execute button once you have entered the command correctly.
Now, if you browse to your share with Windows Explorer, the files should now be available.
Change File Systems
Another way that you can avoid this problem is to change the file system on your FreeNAS server. If you choose a file system that does not support file permission (e.g. FAT32), then there is no real way that permission can be set on the files and no way that you can be denied access to the files from a file permission level.
Note: It is still possible to lock people out from accessing the files from a share level.
Recommendations
Both of these solutions will work and provide you with what you need i.e. access to your files. But, I lean toward the first solution because it allows you to both backup and secure your files on an ongoing basis. This way, if you need to recover some lost data, only you can get access to it.
But, if you are in an environment where you trust those who have access to your FreeNAS box (e.g. your home system), then I would say the second solution would work just fine for you.