Solved

Autorun on a USB drive

Posted on 2011-03-18
20
786 Views
Last Modified: 2012-05-11
I've created a VB.NET executable to run on a USB stick.  Below is my autorun.inf.

[autorun]
open=BiltUSB.exe
action=Run Peterbilt USB Application
icon=BiltUSB.exe

I delivered the end product to the customer, expecting to be finished with this only to have a variety of issues.
I got him to reset to default each of the entries under the USB's properties....which apparently means 'Prompt me each time to choose an action'.
With his computer, the default form that displays refers to it wanting to open Pictures (I do have pdf files in a subfolder).  And my 'action' entry above does not display in his action list.  He goes to another computer it displays properly.  He goes to another computer and it does the same thing it did on the first computer.

If you have an autorun.inf at the ROOT of the drive, why would it not AUTOMATICALLY run the autorun.inf????  Provided the settings were to prompt each time.  Just another ideosynch from Microsoft??  Or am I missing something??

Sincerely,
Phil Tate
0
Comment
Question by:TSFLLC
  • 8
  • 4
  • 3
  • +3
20 Comments
 
LVL 3

Expert Comment

by:CombatGold1
ID: 35166475
Whether or not removable media can make use of the AutoRun feature depends on what settings are defined on your computer. It is not uncommon for AutoRun to be disallowed especially on computers in corporate networks, as it is really a gigantic security risk.

Windows 7 has completely removed the ability to specify an OPEN option in the autorun.inf file for USB media, which is likely to be the cause of your problem. CD's and DVD's can still open a program with AutoRun though.

Further information:
http://blogs.technet.com/b/srd/archive/2009/04/28/autorun-changes-in-windows-7.aspx
http://www.samlogic.net/articles/autorun-usb-flash-drive.htm
0
 

Author Comment

by:TSFLLC
ID: 35166587
I've already reviewed the samlogic.net article.  I'm aware of the situation with Windows 7...these are not Windows 7 machines.

Regardless of that, if someone clicks on 'AutoPlay' when right-clicking on a USB drive, wouldn't you think it would run the autorun properly?

This set of steps was the tell-all that says it is not working properly at all.  My customer and I have resigned ourselves to the idea that their clients might need to right-click and click AutoPlay to run the app, but where's Microsoft's logic (or some internal settings other than 'Prompt me each time') that would cause my autorun.inf not to display the dialog properly???
0
 
LVL 83

Expert Comment

by:Dave Baldwin
ID: 35220256
A recent security update on XP said it was to disable Autorun on everything but CDs and DVDs.
0
Windows Server 2016: All you need to know

Learn about Hyper-V features that increase functionality and usability of Microsoft Windows Server 2016. Also, throughout this eBook, you’ll find some basic PowerShell examples that will help you leverage the scripts in your environments!

 
LVL 53

Accepted Solution

by:
Bill Prew earned 500 total points
ID: 35220290
You might want to check out this somewhat related question, might have some useful info.

http://www.experts-exchange.com/OS/Miscellaneous/Q_26722200.html

~bp
0
 
LVL 44

Expert Comment

by:Darr247
ID: 35220719
> A recent security update on XP said it was to
disable Autorun on everything but CDs and DVDs.

For what it's worth, it wasn't just XP...
see http://support.microsoft.com/KB/971029

KB971029 can be uninstalled from add/remove programs, and the 'don't show me this update again' box checked in windows update, but windows update will then nag you every time telling you there's been a critical update ignored.
0
 
LVL 38

Expert Comment

by:BillDL
ID: 35220999
Just for your info, AotoPLAY is not the same as AutoRUN:

http://windows.microsoft.com/en-US/windows-vista/Whats-the-difference-between-AutoPlay-and-autorun

http://www.dslreports.com/forum/r21106365-Autorun-vs-Autoplay

http://www.google.com/search?hl=en&source=hp&q=difference+between+autoplay+and+autorun

On computers where various AutoPlay Handlers are set to run on detection of different content types on, AND where AutoRun is still enabled for, removeable drives, the AutoPlay Handler AND the program or file referenced by the "open" command in the autorun.inf will usually launch.

Where AutoRUN has been disabled by a Hotfix, Group Policy, by a tweaking utility, or manually in the registry, the only way you will be able to get your Flash Drive to AutoRun is by messing in the user's registry, or asking them to do so before inserting the Flash Drive.  That is not an acceptable request as far as I am concerned.

To have content on your Flash Drive launched by the AutoPLAY feature of Windows, you would first have to install and register a custom application on their computer as an autoplay handler, or use an existing one that opened (for example) a file with a link to run your program from the Flash Drive:

http://windowsxp.mvps.org/autoplayhandlers.htm

http://msdn.microsoft.com/en-us/library/bb776827(v=vs.85).aspx

In my opinion, the restrictions in place are valid and have been imposed for a very good reason.  Countless thousands of viruses are spread using the AutoRun and AutoPlay features of Windows.
0
 
LVL 44

Expert Comment

by:Darr247
ID: 35221062
> Just for your info, [...]

Just for "whose" info?   :-)
0
 
LVL 38

Expert Comment

by:BillDL
ID: 35221445
Yeah, sorry. It was primarily for TSFLLC (Phil Tate) to address the description in his question and follow-on comment which clearly mentions the AutoPlay Handlers dialog as though directly related to the autorun.inf file.
0
 

Author Comment

by:TSFLLC
ID: 35222718
Thanks to all who have posted after moderator intervention.

My customer wants this function to work....period.  And having expended major resources on this application and now additional time with this Autorun issue....I'm on board.

That being said....

In reviewing these posts & links, I want to be able to modify the registry entry to enable Autorun.  The post by billprew refers to a Microsoft Fix where Autorun can be disabled/enabled.  I would like to programmatically perform this in a batch file.  The Registry DWORD is 'NoDriveTypeAutoRun'.  However, based on the information in the MS Support article http://support.microsoft.com/kb/967715/ the DWORD value is not the same for ALL operating systems.  GO FIGURE!!  Therefore I would need to identify the operating system and edit the entry accordingly.

I created a file onto my USB stick called freg.bat with the following entry:

regedit.exe /s FReg.reg

I also created the FReg.reg file shown above with the following entries:

Windows Registry Editor Version 5.00

[HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Policies\Explorer]
"NoDriveTypeAutoRun"=dword:00000091

When I double-click on the file freg.bat located on the stick I assumed it would run with no problem.  It didn't.  I attempted it from the Command Prompt after changing to the appropriate drive letter and the image included contains the error I received.  I created a screen image because of the character in front of the 'r'.

When I type:  regedit.exe /s FReg.reg
It works fine.  Apparently there is issue with batch file/regedit inclusion I don't know about.
prompt.jpg
0
 
LVL 83

Expert Comment

by:Dave Baldwin
ID: 35222930
Why don't you put it on a CD?  I would take offense that you are trying to get around the security setup on my computer.  If I knew about it.
0
 

Author Comment

by:TSFLLC
ID: 35222939
Content can/will regularly be changed on each USB stick.  It is the responsibility of the user to keep their stick.  CDs are not an option.
0
 

Author Comment

by:TSFLLC
ID: 35222941
Given the simplicity of using a CD, I would have already gone that direction....
0
 
LVL 83

Expert Comment

by:Dave Baldwin
ID: 35222982
Then put the install on a CD and use the USB just to transfer data... ??
0
 

Author Comment

by:TSFLLC
ID: 35223015
Dave,

The user is a customer of a customer.  Most barely know how to turn on a computer.  That being the case, it has to be automated with the least amount of effort on their part.  Since my customer lowballed me on this job (and I needed the job severely last month), and the application is completed and flawless, I really don't want to put any more effort into it.

This one has left a bad taste in my mount.  However, if this option doesn't work, I'll look at that.  It would definitely resolve the removable drive autorun issue altogether.

Thanks.
0
 

Author Comment

by:TSFLLC
ID: 35223018
Sorry, guys.  Ignore my issue with not being able to run the registry change batch file I posted.  I resolved the problem.  Think I had a misspelling associated with the reg file.  Because I was using the /S it didn't inform me there was a problem with the file name.

I will give new files to my customer for their testing with different PCs.
0
 
LVL 44

Expert Comment

by:Darr247
ID: 35223081
Did you redirect an echo to create the files on the USB stick, use edlin, or what?

Building the files manually (in notepad, copy/pasted from your message above) works fine running from a USB stick on an XP machine, here.

Autorun-FReg-batch.png
0
 
LVL 44

Expert Comment

by:Darr247
ID: 35223083
Guess I should have hit refresh before posting.
0
 

Author Comment

by:TSFLLC
ID: 35223539
Thanks Darr247...
0
 

Author Closing Comment

by:TSFLLC
ID: 35286676
A subsequent posting in the link provided by billprew was good information for problem resolution.

http://support.microsoft.com/kb/967715/
0

Featured Post

VMware Disaster Recovery and Data Protection

In this expert guide, you’ll learn about the components of a Modern Data Center. You will use cases for the value-added capabilities of Veeam®, including combining backup and replication for VMware disaster recovery and using replication for data center migration.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Recently Microsoft released a brand new function called CONCAT. It's supposed to replace its predecessor CONCATENATE. But how does it work? And what's new? In this article, we take a closer look at all of this - we even included an exercise file for…
When you start your Windows 10 PC and got an "Operating system not found" error or just saw  "Auto repair for startup" or a blinking cursor with black screen. A loop for Auto repair will start but fix nothing.  You will be panic as there are no back…
As developers, we are not limited to the functions provided by the VBA language. In addition, we can call the functions that are part of the Windows operating system. These functions are part of the Windows API (Application Programming Interface). U…
With the advent of Windows 10, Microsoft is pushing a Get Windows 10 icon into the notification area (system tray) of qualifying computers. There are many reasons for wanting to remove this icon. This two-part Experts Exchange video Micro Tutorial s…

803 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question