Jump to content

Running networked exe without Windows warnings


 Share

Recommended Posts

Hey guys.

I have a script that is running on the network and launches some .exe's when needed. But since its networked and im using ShellExecute(), Windows protests with a "Do you really want to run this application" window.

Func runEXE()
 
$mainpath = @ScriptDir
;establish if running from network
If StringInStr($mainpath, "\\") then $networked = "1"
If $networked = True then
   ShellExecuteWait($mainpath & "\exe\exe1.exe", "some parameters")
   ShellExecuteWait($mainpath & "\exe\exe2.exe", "some parameters")
   return 1
else
   return 0
endIf
 
EndFunc

There is only one way to disable the warning that I know of, this link has all the info: http://marsbox.com/blog/howtos/disable-do-you-want-to-run-this-file-prompt/

So I can script the clicks needed to fill all out that with ControlClick() and ControlCommand(), but that seems really inefficient and just not clean...

According to Microsoft KB there is a way to add these records by registry: http://support.microsoft.com/kb/182569/en-us?fr=1

In the end the registry adding would look like this:

RegWrite("HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Internet Settings\ZoneMap\Domains\servername" , "file" , "REG_DWORD" , "1")

Which accomplishes the task of getting the \\servername in the Intranet Zone list.

Now to the problem:

It doesnt get applied. From what I can understand from the KB article, the changes need to be applied through Urlmon.dll file using MapUrlToZone, but I can be wrong.

Anyone ran into anything like this?

Thanks,

tom

Edited by tomaskir
Link to comment
Share on other sites

Here's how to disable the prompts:

Start > Run

In the run box, type in gpedit.msc

Expand User Configuration

Expand Administrative Templates

Click on Attachment Manager

On the right pane, double click "Inclusion list for moderate risk file types"

Set it to enable AND in the box below, type in ".exe" (without the quotes).

#include <ByteMe.au3>

Link to comment
Share on other sites

Copy it into the local TEMP directory and run it from there..

That would be a solution, but the exe's require additional files to work, all together its good 500mb, so copying it would be slow.

Here's how to disable the prompts:

Start > Run

In the run box, type in gpedit.msc

Expand User Configuration

Expand Administrative Templates

Click on Attachment Manager

On the right pane, double click "Inclusion list for moderate risk file types"

Set it to enable AND in the box below, type in ".exe" (without the quotes).

GPedit only works on Proffesional and higher versions of Windows. (tested it with Win 7 Home Premium and Proffesional)

Also, scripting all that would be as painful as scripting it through Internet Options ;)

If I found how to set those through registry I would still have to do a gpupdate after for it to apply too I think.

Thanks for the suggestions tho guys :graduated:

Edited by tomaskir
Link to comment
Share on other sites

You may use the run function and set the working directory to your specified network path...

Trying it with run(), however:

Does run() have trouble with .msi? If I try to run an .exe with run() it works fine, however with .msi it does nothing.

EDIT: nvm, figured out I need msiexec

Edited by tomaskir
Link to comment
Share on other sites

You'd need to run MSIEXEC.exe to run your .msi program.

If I posted any code, assume that code was written using the latest release version unless stated otherwise. Also, if it doesn't work on XP I can't help with that because I don't have access to XP, and I'm not going to.
Give a programmer the correct code and he can do his work for a day. Teach a programmer to debug and he can do his work for a lifetime - by Chirag Gude
How to ask questions the smart way!

I hereby grant any person the right to use any code I post, that I am the original author of, on the autoitscript.com forums, unless I've specifically stated otherwise in the code or the thread post. If you do use my code all I ask, as a courtesy, is to make note of where you got it from.

Back up and restore Windows user files _Array.au3 - Modified array functions that include support for 2D arrays.  -  ColorChooser - An add-on for SciTE that pops up a color dialog so you can select and paste a color code into a script.  -  Customizable Splashscreen GUI w/Progress Bar - Create a custom "splash screen" GUI with a progress bar and custom label.  -  _FileGetProperty - Retrieve the properties of a file  -  SciTE Toolbar - A toolbar demo for use with the SciTE editor  -  GUIRegisterMsg demo - Demo script to show how to use the Windows messages to interact with controls and your GUI.  -   Latin Square password generator

Link to comment
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
 Share

  • Recently Browsing   0 members

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