dslreports logo
site
 
    All Forums Hot Topics Gallery
spc

spacer




how-to block ads


Search Topic:
uniqs
1063
share rss forum feed

markgsargent

join:2014-05-14
Australia

1 edit

[WIN7] Can't Run Commands as Admin in CMD on Win7 64

Hi All,

am logged in with an account that is a member of the Admin Group, but can't run commands that make system wide changes. I get the below for example.

---
C:\Windows\system32>powercfg -devicedisablewake "Generic USB Hub"
You do not have permission to enable or disable device wake.
---

Now, I also followed the steps in the below article, to no avail with the result posted above. What am I missing here? Thanks.

http://technet.microsoft.com/en-us/library/cc947813(v=ws.10).aspx

EDIT: Ok, I've found the below article, but I don't wish to log in as the Elevated Administrator, for obvious reasons. Does Win7 have a SUDO functionality like Linux?

http://www.sevenforums.com/tutorials/507-built-administrator-account-enable-disable.html

Mark


plencnerb
Premium
join:2000-09-25
Carpentersville, IL
kudos:3
Well, as you have figured out, just using an account (not the local administrator account) that is a member of the group "Administrators" is not enough for the command.

So, you did some research, and found out how to open the command prompt as the local administrator.

To make sure that you are doing those steps correctly, you should see a different command prompt window. Let me explain.

From my normal user account, if I just open a command prompt, it looks like this




Things to note is that at the top of the window, it shows the full path to cmd.exe. Also of note is that my default starting location is in my user's profile directory. In this case, its "C:\Users\Brian A. Plencner".

If however, I do the right-click on the shortcut for cmd from my start screen (in your case, from the Windows Start Menu), you should get some kind of UAC prompt, like the one below




When you select yes, you will get a command prompt window. However, this one will be different then the one above in the following ways:

The text in the title bar at the top won't have the full path to cmd.exe. Instead, it will say "Administrator: Command Prompt"

The 2nd thing that will be different is your default path. Instead of it being the root of your user profile directory, it will be "C:\Windows\System32"




That's how you can tell if you are running the command prompt using the local administrator account.

Let me know if that is the case. I would think if you were running that command from the local administrator's command prompt, it should work without issues.

--Brian
--
============================
--Brian Plencner

E-Mail: CoasterBrian72Cancer@gmail.com
Note: Kill Cancer to Reply via e-mail

markgsargent

join:2014-05-14
Australia
reply to markgsargent
Ok, I gotta admit, that seems well, moronic. From the User account I was in, I couldn't run certain commands, but I could go in and Enable the Elevated Admin account, log off, and then log into that, without a password, and run whatever I wanted. I mean, that's not "real secure" is it? Or, am I missing something?

Mark

markgsargent

join:2014-05-14
Australia

1 edit
reply to plencnerb
Click for full size
Thanks, plencnerb. It seems, though I am doing the steps correctly, that I do get the Admin CMD Prompt, after I get the UAC prompt, where I click yes. I've added an image of the CMD prompt I get. So why won't the command run? Thanks.

Mark


plencnerb
Premium
join:2000-09-25
Carpentersville, IL
kudos:3
reply to markgsargent
OK I see you made an edit after my post. So, I've removed what I have said. Let me re-look at your edit, and try to come up with an answer!

--Brian

--
============================
--Brian Plencner

E-Mail: CoasterBrian72Cancer@gmail.com
Note: Kill Cancer to Reply via e-mail


plencnerb
Premium
join:2000-09-25
Carpentersville, IL
kudos:3
reply to markgsargent
Ok, I did some research. Here is what I found out.

First, I don't think it matters if you use - or / with the parameters of powercfg. Both appear to work. Wanted to point that out as I used / in finding out the help for the command.

In case you have not done that yet, here is the help for the command with the devicedisablewake switch

C:\Windows\system32>powercfg /devicedisablewake /?
 
POWERCFG /DEVICEDISABLEWAKE <DEVICENAME>
 
Description:
  Disables the specified device from waking the system from a sleep state.
 
Parameter List:
  <DEVICENAME>    Specifies a device. This device name may be retrieved using
                  "POWERCFG /DEVICEQUERY wake_armed".
 
Examples:
  POWERCFG /DEVICEDISABLEWAKE "Microsoft USB IntelliMouse Optical"
 

To verify you have the right device name, you might want to try to run the command "POWERCFG /DEVICEQUERY wake_armed", and see what that comes back with.

When I run that on my system, from the administrator command prompt, I get this




Knowing that "Generic USB Hub" does not show up, I would think the command should fail for me, or give me some kind of odd error. This is what I get when I run your command.




As you can see, it fails for me almost the same way it does for you. While the text is different (I think because I'm running Windows 8.1 Update 1, and you are on Windows 7), it still looks like a permissions issue. When in reality on my system, the "Generic USB Hub" is not in the list, so I probably cannot modify the option "devicedisablewake" on something that may not be a "valid" device. Not to say that "Generic USB Hub" is not valid...it most certainly is. It just may not be a "valid" device that you can use with that command.

--Brian

--
============================
--Brian Plencner

E-Mail: CoasterBrian72Cancer@gmail.com
Note: Kill Cancer to Reply via e-mail

dave
Premium,MVM
join:2000-05-04
not in ohio
kudos:8
Reviews:
·Verizon FiOS
Could be just poor messages. Windows error 5 is ERROR_ACCESS_DENIED. The true meaning of this is "this process can't do that operation to that thing at this time". One of the possible causes of not being able to "do that to it now" might be a permission or privilege issue, but it's not the only reason.

As my wording suggests, there are many variables: process, operation, object, time. Maybe the operation requested is incompatible with some current state of the device. Etc.


markgsargent

join:2014-05-14
Australia
reply to markgsargent
Ok, a little background on why I'm trying to run this command in the first place. See content from below post.

http://www.dslreports.com/forum/r29246635-WIN7-USB-Device-Brings-Win7-Out-of-Sleep-Mode

Now, this is where it gets weird. Yes, I had already ran the powercfg -wake_enabled command, with similar results to above.

---
C:\Windows\system32>powercfg -devicequery wake_armed
HID-compliant mouse
HID-compliant mouse (005)
HID Keyboard Device (005)
HID Keyboard Device (006)
---

Now, I've confirmed by steps taken as per above thread, and identified it as a USB connected device issue. So, I thought for the time being, I would disable the wake function for all USB connected devices. My query now, is, how can the USB connected device do what it's doing if USB doesn't even appear in the wake_armed output. So I went and did the below command and from that chose the original command I'm having issues with. I'm simply stumped at this stage as to what is causing the original issue in the other thread. Thanks.

Mark

---
C:\Windows\system32>powercfg -devicequery wake_from_any
HID-compliant device
USB Root Hub
HID-compliant mouse
2nd generation Intel(R) Core(TM) processor family PCI Express Controller - 0101
High Definition Audio Controller
USB Root Hub (001)
USB Input Device (003)
Renesas Electronics USB 3.0 Root Hub
Renesas Electronics USB 3.0 Host Controller
Intel(R) 6 Series/C200 Series Chipset Family USB Enhanced Host Controller - 1C26

HID-compliant device (003)
Generic USB Hub (003)
HID-compliant consumer control device
HID-compliant mouse (005)
Intel(R) 6 Series/C200 Series Chipset Family USB Enhanced Host Controller - 1C2D

IPBusEnum Root Enumerator
USB Input Device (010)
USB Input Device (011)
UMBus Enumerator
Intel(R) 6 Series/C200 Series Chipset Family PCI Express Root Port 1 - 1C10
Intel(R) Management Engine Interface
Realtek PCIe GBE Family Controller
HID-compliant device (009)
Intel(R) 6 Series/C200 Series Chipset Family PCI Express Root Port 6 - 1C1A
Generic USB Hub (004)
PCI standard PCI-to-PCI bridge
Intel(R) 6 Series/C200 Series Chipset Family PCI Express Root Port 7 - 1C1C
Intel(R) 82801 PCI Bridge - 244E
USB Composite Device (007)
HID Keyboard Device (005)
USB Composite Device (008)
Generic USB Hub (005)
HID Keyboard Device (006)
USB Input Device (018)
Intel(R) 6 Series/C200 Series Chipset Family PCI Express Root Port 8 - 1C1E
---