5

I've successfully connected to my Windows 7 desktop over wifi via Telnet from an XP Home netbook. To login, I use the following command:

telnet -l "win7desktop\win7user" win7desktop

win7user in this case is an Administrator on win7desktop and is also a member of the Telnet Clients Group.

The problem I have is that when I attempt to shut down win7desktop by issuing the following command:

shutdown /s

...at the Telnet prompt, I get an Access Denied error:

Access is denied.(5)

Is it possible to shutdown a remote computer running Windows 7 via Telnet? If so, what do I need to do to get around the Access is denied error?

3
  • 3
    You shouldn't use telnet, ever. All data, including login credentials, are sent in the clear.
    – Iszi
    Jun 3, 2011 at 17:26
  • 1
    @Iszi unless you are on a closed network where that isn't an issue.
    – Rob
    Feb 16, 2012 at 14:54
  • 1
    @Rob Unless said network is just a VM environment running on your own machine, and the VM network is not communicating with the host or other systems connected to the host, I wouldn't trust any network to be absolutely "closed" - especially one where credentials are being sent in the clear.
    – Iszi
    Feb 16, 2012 at 15:10

6 Answers 6

7

Is it necessary to use telnet?

If not, you can use PsShutdown to shutdown a remote computer. Or, you can use PsExec and call the shutdown command.

psshutdown -u <username> -t 0 -k
psexec -d -u <username> shutdown -t 0 -s
1
  • If it's not possible with Telnet, I'll try one of these options, thanks. Apr 20, 2010 at 12:08
3

You're getting a permissions error. As I understand it, even users who are Administrators sometimes need to elevate privileges to run certain commands.

You should try running the shutdown command with runas (aka sudo for Windows):

runas /noprofile /user:Administrator shutdown /s
2
  • The win7desktop\win7user is an administrator on the target machine, do I therefore do runas /user:win7user ... ? Or do I need to explicitly say /user:Administrator ? (What would be the password for Administrator ?) Apr 20, 2010 at 12:10
  • I've tried this with both /user:Administrator and /user:win7user, both with the same access denied error.. Apr 21, 2010 at 13:02
1

There are certain cases where Shutdown.exe does not work:

  • The target computer has just restarted and is applying policies.

  • A shut down of the target computer is in progress or has already occurred.

  • The log on dialog box is open on the target computer.

  • An expected or unexpected shutdown dialog box is open on the target computer.

1
  • None of these apply in this instance.. Apr 20, 2010 at 12:08
1

To save others looking in future; I did all the Firewall, Local Security Policy guff, but no go. This is the real trick for Win 7.

Access is denied

  • All Windows flavors. The account you are executing the reboot command needs to be an Administrator on the machine that you are trying to reboot. If you want to execute the shutdown command as a different user, try psshutdown. The command will look like this when specifying a user (where -r is for reboot and -u is for the user)

    psshutdown 10.0.0.4 -r -u roger

  • In Windows XP, you will have to have “Simple File Sharing” disabled. Otherwise you will get the error message “Win 32: Access is denied”. To disable simple file sharing launch a My Computer window.

    From Tools menu select Folder Options, go to the View tab and remove the check from “Use simple file sharing (Recommended)”.

  • In Windows 7 and Windows Vista, a small registry trick is needed. If you are getting the “Win32: Access is denied” message, launch a registry editor (on the machine that you want to remotely reboot).

    • Type regedit in the Run box
    • Go to HKEY_LOCAL_MACHINESOFTWAREMicrosoftWindowsCurrentVersionPoliciesSystem
    • Check the right side of the window to see if you have an entry for LocalAccountTokenFilterPolicy. If you do change its value to 1
    • If the entry does not exist, right click, select New > DWORD (32-bit) Value and name it LocalAccountTokenFilterPolicy. Then double click the new entry and change its value to 1
    • Reboot your machine
0

If you just typed shutdown -i in Windows 7 command prompt, then it prompts to remote shutdown dialog box.

It shows like a box containing

computer name : {add} 
                {remove}
                {browse}

and what you want this computer to do:

  • restart
  • logoff
  • shutdown
  • annotate unexpected shutdown

Then all you have to do is to fill it out.

0
shutdown /f /s

or

shutdown /f /r

Don't use /l.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .