MrBedo Posted March 21, 2006 Posted March 21, 2006 (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 March 21, 2006 by MrBedo
GaryFrost Posted March 21, 2006 Posted March 21, 2006 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 thisfrom the help fileInitialise 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.
MrBedo Posted March 21, 2006 Author Posted March 21, 2006 (edited) Note to self.......RTFM !! Sorry and thanks Edited March 21, 2006 by MrBedo
Administrators Jon Posted March 21, 2006 Administrators Posted March 21, 2006 Do the standard trick of re-running your own script with admin rights using RunAsSet. There's a code snippet about somewhere. Deployment Blog: https://www.autoitconsulting.com/site/blog/ SCCM SDK Programming: https://www.autoitconsulting.com/site/sccm-sdk/
seandisanti Posted March 21, 2006 Posted March 21, 2006 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")
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now