0
votes

Every time I try to run a script that includes the line Set xlObj = CreateObject("excel.application") in vbscript, I get an error saying "Line Requires Elevation". I assume this is a permissions issue, but I'm an admin on the machine where I'm trying to run this script, so I'm not sure what I need to do about this.

1
Are you using Windows 7 or higher? Have you tried running the script from an elevated command prompt? Right click on cmd.exe "Run as Administrator" - Matt
Does the error come from VBS\CScript.exe or from Excel? By default the built-in administrator does not get hassled by UAC. If you are an admin by virtue of being a member of the Local Administrators group then you will need to negotiate UAC. UAC kicks in when you attempt to create a process. If you can't disable UAC or run your script from a pre-elevated prompt. However Excel does not normally require elevation as it doesn't require access to system resources. Check whether Excel is trying to run a VBA macro which may need to be elevated. - Stephen Connolly
I wonder if someone has set compatability on Excel to Run As Admin. Find the exe, not a shortcut, and check (right click - Properties - Compatability tab). Also check COM security. Look up HKCR\Excel.Application. Read the ClassID and look up HKCR\CLSID\<the class id>. Get the AppID and look up HKCR\AppID\<the app id>. On Office XP you'll get to HKCR\AppID\{00020812-0000-0000-C000-000000000046} which by default only has the display name of Excel. - Noodles
AccessPermission, ActivateAtStorage, AppID, AuthenticationLevel, DllSurrogate, DllSurrogateExecutable, Endpoints, LaunchPermission, LocalService, RemoteServerName, RunAs, ServiceParameters, SRPTrustLevel are the possible settings. - Noodles
Shift + Right Click your script and choose Copy As Path. Right click a command prompt shortcut and choose Run As Administrator. In that window right click and choose Paste. Does your script work? - Noodles

1 Answers

0
votes

There is no mystery about it. We told you and you said "No that can't be it". If set to admin then a non admin can't access it.