Super User is a question and answer site for computer enthusiasts and power users. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I'm working on a project that I need to allow Windows Remote Desktop connections with the wmic interface using the following command:

wmic RDToggle where servername=”ServerName" call SetAllowTSConnections 1

But everytime I try to execute the wmic RDToggle command it returns me the same error(I already tested it on three different machines with the same result):

enter image description here

As you can see, not even WMIC command to query TS Connections settings is working...

Am I forgetting something before running the command??? Any tips?

PS: I'm running cmd from elevated mode....

share|improve this question
For the first one, try wrapping %COMPUTERNAME% in quotes to get rid of the "unexpected switch" error (I'm pretty sure it's caused by the hyphen in the PC's name): servername="%COMPUTERNAME%" – Ƭᴇcʜιᴇ007 May 30 '12 at 21:23
For the second one, if you copy/pasted it, try typing it out manually to ensure there's no weird web-encoded characters. :) – Ƭᴇcʜιᴇ007 May 30 '12 at 21:24
up vote 0 down vote accepted

I just typed in wmic RDToggle get AllowTSConnections. My cmd window ran the command fine; in my case it stated this

C:\Windows\System32> wmic RDToggle get AllowTSConnections AllowTSConnections 0

C:\Windows\System32> (Blinking cursor)

I dont know what to tell you.

Type ipconfig/all and post that, then type netstat and post that too. I'll take a look into it for you. Also, I haven't messed with command line in ages so I am venturing in to old seas again. I'll have to read up and familiarize myself. I'll be back in an hour!



I came back and found something relevant to your problem. I was trying to replicate your problem on my PC and couldn't exactly do it. Give this a shot:

The behavior seems to be caused by a failure to mofcomp specific mof/mfl files on that machine. The logs in %windir%\system32\wbem\logs might give you a clue why the root\cimv2 namespace is missing. If that doesn't help, try to rebuild the WMI repository by running the following batch.

Net stop winmgmt /y If exist "%windir%\system32\wbem\repository.old" rmdir /s/q "%windir%\system32\wbem\repository.old"

Rename "%windir%\system32\wbem\repository" "%windir%\system32\wbem\repository.old"

for /f %s in ('dir /b /s %windir%\system32\wbem*.dll') do regsvr32 /s %s

-- Andy Cheung Microsoft WMI Test Engineer

All credit goes to Andy Cheung.

PS: What OS are you running?

Here's some useful bits and pieces for WMIC that you might be interested in...

share|improve this answer

You must log in to answer this question.

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