Jump to content

Should 'runasset' Work When Deleting Files ?


Recommended Posts

I have a script which uses RunAsSet to envoke admin permissions. The first part of my script installs a program and this part works exactly like it should, but the second part which then deletes a shortcut from the "C:\Documents And Settings\administrator\Start Menu\Programs\Startup" folder doesn't work unless I log onto the PC as the admin and run the script.

The script runs when a user logs onto their PC, this user does not have admin permissions which is why RunAsSet is used.

I just find it odd that the delete part of the script works if I run it whilst logged on as an admin, but not when logged on as a user. The RunAsSet command is obvously working when logged on as the user because it installs the program as it should (which does require admin permissions).

Does that mean the FileDelete command is not affected by the RunAsSet command ?

Heres the very simple script I'm using.

SplashTextOn("Program Install", "Please wait while programs are installed and configured on your system....", -1, 55, -1, -1, 1, "Times New Roman", 18)

RunAsSet("administrator", "domainname", "password")

Runwait('msiexec /i c:\program.msi /qn')

FileDelete('C:\Documents And Settings\administrator\Start Menu\Programs\Startup\program.lnk')

SplashOff()

Thanks in advance if anyone can shed any light on this

Edited by MrBedo
Link to comment
Share on other sites

I have a script which uses RunAsSet to envoke admin permissions. The first part of my script installs a program and this part works exactly like it should, but the second part which then deletes a shortcut from the "C:\Documents And Settings\administrator\Start Menu\Programs\Startup" folder doesn't work unless I log onto the PC as the admin and run the script.

The script runs when a user logs onto their PC, this user does not have admin permissions which is why RunAsSet is used.

I just find it odd that the delete part of the script works if I run it whilst logged on as an admin, but not when logged on as a user. The RunAsSet command is obvously working when logged on as the user because it installs the program as it should (which does require admin permissions).

Does that mean the FileDelete command is not affected by the RunAsSet command ?

Heres the very simple script I'm using.

SplashTextOn("Program Install", "Please wait while programs are installed and configured on your system....", -1, 55, -1, -1, 1, "Times New Roman", 18)

RunAsSet("administrator", "domainname", "password")

Runwait('msiexec /i c:\program.msi /qn')

FileDelete('C:\Documents And Settings\administrator\Start Menu\Programs\Startup\program.lnk')

SplashOff()

Thanks in advance if anyone can shed any light on this

from the help file

Initialise a set of user credentials to use during Run and RunWait operations. 2000/XP or later ONLY.

what you could do is create a small script that has all the commands it you want run under the other credentials, compile that then add a fileinstall and runwait for that script in the main script.

SciTE for AutoItDirections for Submitting Standard UDFs

 

Don't argue with an idiot; people watching may not be able to tell the difference.

 

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...