Access Denied error when shutting down remote computer

I recently discovered the Windows command line shortcut to shut down a remote computer in a local network - how exciting, a whole new way to be lazy! But sadly I seem to be thwarted in my laziness by some lack of access rights between my computers.

Both machines are running Windows 7 Home Premium, they are both on a network (and in a Homegroup), both are password protected with different login names and different passwords.
The command I’m trying to run is “shutdown /m \COMPUTERNAME /s”; the error I am getting is “COMPUTERNAME: Access is Denied.<5>”

What do I need to do to make this work? Should I create a new user account on my desktop with the same name and password as the default account on my laptop? (Also does anyone know of a remote STARTUP script, to save me from having to get out of bed in the morning?)

I’m guessing it wants you to run that command as an administrator. If you start up a command prompt as an admin (right click on the command prompt and select run as admin) does it let you do it?

I know people hate it in these sort of threads, but you really need to run PsShutdown instead. Get it here.

There’s a lot of good documentation on it, which will explain how to solve your problem.

The account you’re using on the local computer needs to be an administrator on the remote computer. Have a look at this Microsoft Knowledge Base article for full details about the command: Restart or Shut Down a Remote Computer and Document the Reason | Microsoft Learn

I don’t see a way to specify the credentials to use (unfortunate), but I imagine you can stack shutdown within a runas. However, that will authenticate against your local computer, not the remote computer. It might still work if you do create an account on the local computer with the same username and password as an administrative account on the remote computer, and try running it that way… but I believe that Windows knows the accounts are different.

I’m more used to Windows accounts on domains than workgroups. Can you add one computer’s account to the other computer, as an administrator? That’s what you really need to do to get this to work.

Use psshutdown (or psexec to run shutdown) - it lets you specify the username and password to use to connect to the remote computer, which is necessary if your local login isn’t valid on the remote computer.

I dimly recall that command requiring WMI. You may need to allow access.