Create an account

Very important

  • To access the important data of the forums, you must be active in each forum and especially in the leaks and database leaks section, send data and after sending the data and activity, data and important content will be opened and visible for you.
  • You will only see chat messages from people who are at or below your level.
  • More than 500,000 database leaks and millions of account leaks are waiting for you, so access and view with more activity.
  • Many important data are inactive and inaccessible for you, so open them with activity. (This will be done automatically)


Thread Rating:
  • 521 Vote(s) - 3.49 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Run Batch file as administrator - Windows 7 - Command "Run As" from network file system

#1
I need to set up the delivery of a program installer.

This program has a program_installer.exe and a folder that i cannot include in the installer at the time in which i create the installer.

therefore, when a user needs to install the program i send him a BATCH file via MAIL

@echo off
if DEFINED PROGRAMFILES(X86) (
SET TOOL_INSTALL_DIR="%PROGRAMFILES(X86)%\myfolder"
) else (
SET TOOL_INSTALL_DIR="%PROGRAMFILES%\myfolder"
)

MKDIR %TOOL_INSTALL_DIR%
copy /y \\rk0012352\Public\lkh5iwwh.m4s %TOOL_INSTALL_DIR%


START %PROGRAMFILES%\program_installer.exe

The issue is that, when the user execute the BATCH and run COPY command, on windows 7 the command will fail because he has no ADMIN rights.

How can i make that copy command run as administrator on both XP and 7 ?


You might say: when the user gets the EMAIl with INSTALL.BAT, CAN'T he click RUN AS ADMINISTRATOR?

The answer unfortunately is that most of them will not do that and just complain that it doesn't work. Moreover many email client such as Outlook will prompt "open" "save" choice panel and most of the users will click Open directly(generating the no rights error)

the "run as" commands requires to specify the administrator name for the machine and i cannot know how the admin user is called on every computer.

Any suggestion?
Reply

#2
It's a little bit tricky but it can be done.

First you have to know (from the batch file) if the user is an administrator. If it is then you can simply go on with installation. If it's not you can run another cmd.exe instance to run the batch file as administrator (using the `runas` command).

To detect if the user is an administrator take a look to this post:

[To see links please register here]

(there is the full code to elevate the batch itself too).
Reply

#3
Not the same thing.

There's a difference between elevating your own scope of permissions and just running within your scope if you are in the administrators group.

Simply using `runas /user:[email protected] program.exe` seems not to be the same as right-clicking then selecting "Run as Administrator".
Reply

#4
There is a [way to do this][1] in PowerShell:

PS> Start-Process powershell -Verb runAs


[1]:

[To see links please register here]

Reply



Forum Jump:


Users browsing this thread:
1 Guest(s)

©0Day  2016 - 2023 | All Rights Reserved.  Made with    for the community. Connected through