0

My question is basically identical to this unanswered question: How to run an application as "run as administrator" from the command prompt?

I am working from within the Oracle Enterprise Manager, setting up a "user-defined metric", and using the "execute host command" feature to test things. In both cases one provides a single line that is fed to the command processor on the remote machine (Windows 7). The account on the remote machine is a machine-level account in the administrators user group but is not "administrator". I do not have access to the "administrator" account password. (I am a consultant working in an environment administered by the client.)

Logged in interactively on the remote machine, the account I am using can "run as administrator" a command window without supplying an administrator password, and can run my script successfully. I looked at the "runas" command and tried it out but I could not find a way to use it without supplying the "administrator" account password, which I do not have. The person who posted the other question (above) said he tried the /NOUAC and /elevate options with no success. I have not tried them.

FWIW, the command I am trying to run is a PowerShell v 2 one-liner that gets one WMI value.

Anyhow, it may be that what I am trying to do is by design impossible within the UAC world -- to do these operations one either is an administrator-group user working interactively or one is the administator.

Community
  • 1
  • 1
Quixote
  • 83
  • 1
  • 9
  • I have decided to use a scheduled task running on the remote machine and writing its results into a text file, with the Oracle-based command doing nothing more than retrieving the contents of the text file. I had hoped to avoid installing anything on the remote machine. Oh, well. – Quixote Jul 06 '12 at 19:22
  • If you're trying to access something made available via WMI, have you tried `Get-WMIObject -computername`? You shouldn't need to execute the script *on* the remote machine if WMI is available (though that may not be true of all WMI classes). What WMI class are you attempting to use? – alroc Jul 06 '12 at 23:44
  • I chose to work within the Oracle Enterprise Manager. The way that it implements a "user-defined metric" is to send a command to the remote machine, execute it there, and then look for a formatted line in the standard output from that command. That's consideration #1. #2 is that the security environment seems to prevent (for me) almost all cross-machine accesses -- event logs, PowerShell commands, etc. – Quixote Jul 09 '12 at 18:35

1 Answers1

0

create a batch file with following lines

start

and save it an a location of your choice.

Then right click on the batch file and select "Run as administrator" This would create a command prompt as administrator

falsetru
  • 357,413
  • 63
  • 732
  • 636