View Full Version : Solved: Create delete files vba

09-18-2007, 11:55 AM
I need some help from the pros. I have code to create a shortcut to "All Users" desktop when a document is opened. However, it only works when the user has Admin rights. I am wondering if there is a way to "force" admin elevation for a time. I could upgrade every user's account for a time but that seems a bit extreem. If I have account info for both a domain account and/or local machines that have the neccessary rights. Can I make vba use either of these credentials to execute the code? If not vba then any leads on VB or VBscript?

Bob Phillips
09-18-2007, 01:10 PM
You have to be joking. That would be a security hole bigger than an ocean liner.

09-18-2007, 01:41 PM
Well...No I'm not joking. Is there not a "Run as" and then change credentials to an admin account? So why can't I emulate that through scripting? If I have the neccessary account info but don't wan't to actually perform the log off and log on. It seems like there should be a way. I guess you'd know though...so thanks.

09-18-2007, 11:36 PM
Despite "mentor" xld's extensive knowledge on security holes and ocean liners (and now jokes) he/she is wrong. For those interested I was able to do this with AutoIT and vba. My app is shelled with Auto IT which then uses RUN As to authenticate as an admin. So via a standard logon the code is able to delete and create files (shortcuts in this case) in the All User's folders and startup folders. Saving me from having to log onto 300+ machines and manually create the shortcuts for all users.

XLD - 6,297 posts....wow....Now there is a fountain of knowledge!