Sign in to follow this  
Followers 0
MrBedo

Should 'runasset' Work When Deleting Files ?

5 posts in this topic

#1 ·  Posted (edited)

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

Share this post


Link to post
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.

 

Share this post


Link to post
Share on other sites

#3 ·  Posted (edited)

Note to self.......RTFM !!

Sorry and thanks :)

Edited by MrBedo

Share this post


Link to post
Share on other sites

Do the standard trick of re-running your own script with admin rights using RunAsSet. There's a code snippet about somewhere.

or instead of

filedelete("C:\whatever")

you could

Run("del c:\whatever")

1100111 00001011101111 00011101101111 00010111100100 00001111110100 00110111110010 00101101111001 0011100i didn't make up this form of encryption, but i like it.credit to the lvl 6 challenge on arcanum.co.nz

Share this post


Link to post
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
Sign in to follow this  
Followers 0