Trying to allow Remote Desktop connections via wmic command line but everytime Windows return me an error

5,071

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!

-Xenith

~~~~EDIT~~~~

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:
5,071
Diogo
Author by

Diogo

Updated on September 18, 2022

Comments

  • Diogo
    Diogo over 1 year

    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....

    • Ƭᴇcʜιᴇ007
      Ƭᴇcʜιᴇ007 almost 12 years
      For the second one, if you copy/pasted it, try typing it out manually to ensure there's no weird web-encoded characters. :)