6

I need to run tscon.exe 0 /dest:console remotely = not manually on Windows7 as an administrator. More info here How to use tscon on Windows7?

I did my research and

  • OPTION 1 - runas

for user root (no password) on computer yogurt works

C:\>runas /user:yogurt\root cmd
Enter the password for yogurt\root:
Attempting to start cmd as user "yogurt\root" ...

for user administrator (I thought the the password is blank too) on computer yogurt doesn't work. I am asked for password, hit the enter and

C:\>runas /user:yogurt\administrator cmd
Enter the password for yogurt\administrator:
Attempting to start cmd as user "yogurt\administrator" ...
RUNAS ERROR: Unable to run - cmd
1327: Logon failure: user account restriction. Possible reasons are blank passwo
rds not allowed, logon hour restrictions, or a policy restriction has been enforced.
  • OPTION 2 - setting properties of a batch file so it always runs as administrator. The 'privilege level' section is greyed out for me under Compatibility level. So I am not able to tick the check box Run this program as an administrator
Radek
  • 1,133
  • 4
  • 26
  • 38
  • I'm a little confused about what you're asking, so this may be off base, but run `cmd` elevated, run the command with an administrative user on the remote system? What's the problem, or was that the answer? – HopelessN00b Sep 18 '12 at 23:44
  • @HopelessN00b: I need to run `tscon.exe 0 /dest:console` as administrator to see if it fixed the original issue I am facing. Read the link in my question for more details. I am already running the command under account that is a member of administrators group. There might be another issues involved as @Chris said in his EDIT. I need to read about it. – Radek Sep 18 '12 at 23:57

3 Answers3

7

You may find that the local Administrator account is in fact disabled. Take a look in the Local Users and Groups in Computer Management.

Regardless of that, I wouldn't recommend enabling the account, especially if it really does have a blank password.

Running a program 'as Administrator' (as in on the right-click menu) and doing a RunAs Administrator are not the same thing:

  • Running a program 'as Administrator' means that the program still runs under the context of your user account (i.e. the person invoking the program) but using a modified access token that includes membership of the Administrators group. A process started in this way would show as being owned by you in Task Manager.

  • Using RunAs with the Administrator account really does try to invoke the program under the Administrator account. A process started in this way would show as being owned by Administrator in the Task Manager.

EDIT: Although the above is relevant, I think the real problem might be to do with something called Session 0 Isolation which started with Windows Vista/Server 2008.

Chris McKeown
  • 7,128
  • 1
  • 17
  • 25
  • If I run `tscon.exe 0 /dest:console` on Windows XP I can then run automation testing. On Windows7 I get error when running the test. I want to try if running `tscon.exe 0 /dest:console` as administrator in either mode will help. It must be done non-interactively. Any suggestions? – Radek Sep 18 '12 at 08:19
  • Create a new account that is a member of the Administrators group. Give it a password. Use `RunAs` with that account. – Chris McKeown Sep 18 '12 at 08:30
  • What I understood from my research is that being a member of administrator group is not the same as being administrator. – Radek Sep 18 '12 at 22:24
  • In Windows Vista and later with UAC enabled, you are indeed correct. To replicate the behaviour of XP/2003 and previous, you need to turn off UAC. – Chris McKeown Sep 18 '12 at 22:30
  • OK, I already tried to run under my 'current' account that is a member of Administrators group. And it didn't solve my original issue. So now I want to make sure that I run it 100% as administrator. How do I check that UAC is enabled? Or how do I make sure that I run the command as real administrator? – Radek Sep 18 '12 at 22:37
  • 1
    I have edited my answer, I think your actual problem might be somewhere else – Chris McKeown Sep 18 '12 at 22:48
  • I tried to run `tscon.exe 1 /dest:console` but it didn't help. – Radek Sep 19 '12 at 01:46
  • Not sure what is different or I didn't do it properly before but if I run `tscon.exe 1 /dest:console` as administrator I get what I need. – Radek Sep 24 '12 at 06:53
  • I had to enable the admin account in order to use `runas`. Works now. Thank you. – Radek Sep 24 '12 at 23:49
2

Sysinternals PSExec could do it?

psexec /s "CMD.EXE" \\computer01 -u "domain\user" -P "password"

After the -u, instead of Domain\User you can try Computer01\LocalAdministrativeUser

But really it depends on the local configuration of the remote machine. If you don't already have local administrator accounts on there then you are going to have to create those first.

This will launch a new CMD.EXE running as "nt authority\system" on the remote machine, which is as close to session 0 as you can get these days. Anything you now run in that window is running on the remote machine. Try running IPCONFIG and or HOSTNAME if you are unsure.

Careful. Running at this level allows you to really really break stuff.

Patrick
  • 1,250
  • 1
  • 15
  • 35
-1

to run any program elevated in Windows 7 , hold << LEFT CTRL>> and << LEFT SHIFT>> while launching the program. (ie type cmd and then << Left ctrl>>+<< left shift>>+<< enter>>

erik
  • 1