Win7: Will doing "Run as administrator" on a .BAT file allow regsvr32 enough privlieges to register a DLL or OCX?

2

1

Will doing "Run as administrator" on a .BAT file allow regsvr32 enough privlieges to register a DLL or OCX?

The .bat file contains:

regsvr32 -u SomeOCX.ocx
regsvr32 SomeOCX.ocx

Or, does the logged in user need to be an administrator?

CJ7

Posted 2010-06-04T07:26:12.567

Reputation: 1 060

Answers

1

There can be difficulties with running .BAT files if you need it to run with administrator access. If right-clicking on the .bat file and choosing run as administrator doesn't work, then try starting an elevated command prompt and running the .bat file from there.

CJ7

Posted 2010-06-04T07:26:12.567

Reputation: 1 060

2

"Run as administrator" should provide sufficient permissions if the user account can use that function.

Darth Android

Posted 2010-06-04T07:26:12.567

Reputation: 35 133

When would a user account not be able to use a function? – CJ7 – 2010-06-04T08:11:13.503

@Craig Johnston If the account is not an administrator, and if the user does not know the name and password of an administrator account, they will not be allowed to run applications as an administrator. If the account is not an admin account, they will be asked for valid credentials with which to run the .bat file. – Darth Android – 2010-06-04T13:56:53.293

0

Even if run from an account with administrator privileges (except for The built-in administror account), you will still need to use "run as administrator" to elevate the batch file, because of UAC restrictions. If you will be distributing this batch file or just want to make the process automatic, you may want to check out the Elevation powertoy, which lets you put lines in a batch file to cause it to be automatically elevated and prompt the user accordingly.

nhinkle

Posted 2010-06-04T07:26:12.567

Reputation: 35 057

How do domains affect this? Is there the possibility that "Run as administrator" will elevate to domain-administrator and not local-administrator? – CJ7 – 2010-06-06T06:44:38.160

It will elevate to whatever account you choose. When a computer is a member of a domain, the UAC credentials dialog will prompt you for a username and password; you can choose a local or domain administrator. – nhinkle – 2010-06-06T16:53:40.040