Jump to content

Apply my scripot by Administrator


kater
 Share

Recommended Posts

Hi Guy's :)

Small question

How to can I apply my script by Administrator ?

The normal user can not change any thing in his profile because he do not have permissions to change any thing

and my script will change some thing and i can not give the normal user the password of administrator to change some thing in his profile

I want to install program in this PC and I want to run it by administrator as you sowing in the below

Posted Image

How to can I apply my script by Administrator ? ;)

I thing my idea is very clear

Reg's

Link to comment
Share on other sites

Hi,

RunAsSet

So long,

Mega

Scripts & functions Organize Includes Let Scite organize the include files

Yahtzee The game "Yahtzee" (Kniffel, DiceLion)

LoginWrapper Secure scripts by adding a query (authentication)

_RunOnlyOnThis UDF Make sure that a script can only be executed on ... (Windows / HD / ...)

Internet-Café Server/Client Application Open CD, Start Browser, Lock remote client, etc.

MultipleFuncsWithOneHotkey Start different funcs by hitting one hotkey different times

Link to comment
Share on other sites

  • Developers

Can you please explain to me more ;)

and give me example for that

I wating you !! :)

Have you looked in the helpfile for it ? ;)

SciTE4AutoIt3 Full installer Download page   - Beta files       Read before posting     How to post scriptsource   Forum etiquette  Forum Rules 
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

Link to comment
Share on other sites

  • Developers

Frankly, No ;)

But tell me or give me first code and I'll complete every thing with my self :)

tuurlijk... kijk toch maar even zelf ....

SciTE4AutoIt3 Full installer Download page   - Beta files       Read before posting     How to post scriptsource   Forum etiquette  Forum Rules 
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

Link to comment
Share on other sites

Cmon... We would be offended if you did not look into the helpfile that we have so arduously crafted.

LAr.

I've looked at help file and it seems to me that RunAsSet not works as supposed...

for example:

FileExists("\\share\1\somefolder\file.bat") is telling me that file exists.

If I do Run("\\share\1\somefolder\file.bat"), then I get error message that path cannot be found.

Something is fishy here.

Link to comment
Share on other sites

  • Developers

I've looked at help file and it seems to me that RunAsSet not works as supposed...

for example:

FileExists("\\share\1\somefolder\file.bat") is telling me that file exists.

If I do Run("\\share\1\somefolder\file.bat"), then I get error message that path cannot be found.

Something is fishy here.

Assume you also have RunAsSet() in this script ?

FileExists() runs under the original credentials and Run() uses the RunAsSet() Credentials ... does that explain what you are seeing ? :)

SciTE4AutoIt3 Full installer Download page   - Beta files       Read before posting     How to post scriptsource   Forum etiquette  Forum Rules 
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

Link to comment
Share on other sites

  • Developers

No body wants to help me :)

fyi : I'm new in this application , I want to learn it

Dont think you replied to my post or do you want us to perform miracles for you ? Edited by JdeB

SciTE4AutoIt3 Full installer Download page   - Beta files       Read before posting     How to post scriptsource   Forum etiquette  Forum Rules 
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

Link to comment
Share on other sites

Hopefully to prevent JdeB from blowing another gasket (I nearly fell over laughing at that) I'll try to help explain:

Using RunAsSet is almost like logging out and logging in as that user, accept without all the logging out and in stuff. So, when you change who the script is run as, the new user who the script is running as has no network volumes mounted, and no rights to shares either. So, after using RunAsSet, you basically need to reconnect to whatever network volume you were running from before.

To test for this, as in your example above, test if FileExists both before and after you use RunAsSet, just to see that that is causing the file to disappear.

Link to comment
Share on other sites

Example from the helpfile:

; This example will rerun itself with admin rights on using a local account
; Note on Vista this may not work as even though the user is admin it may 
; not be elevated even after the RunAs call.  In that case use #RequireAdmin
; at the top of the script.

; Are we already admin?
If Not IsAdmin() Then
    RunAsSet('USER', @Computername, 'PASSWORD')
    Run('"' & @AutoItExe & '"' & ' "' & @ScriptFullPath & '"', @WorkingDir)
    Exit
EndIf

MsgBox(0, 'Message', 'Now running with admin rights.')
My UDFs:- _RegEnumKey
Link to comment
Share on other sites

Tiger thanks for your help :)

=========================

I tried to modify in the existing code ,but I faced some errors can you please explain more to me

I want to run this application mspaint.exe by admin user " Run as "

The user name is : Admin

Password is : 12345678

how to can I define that in the code

Edited by kater
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...