WMIC enable Remote Desktop
How to add a user to Terminal Services RDP permissions by using WMI
Is this page helpful?
Please rate your experience
Yes
No
Any additional feedback?
Feedback will be sent to Microsoft: By pressing the submit button, your feedback will be used to improve Microsoft products and services. Privacy policy. Show
Submit
Thank you. In this articleThis article describes three methods to add users or groups to Terminal Services Remote Desktop Protocol (RDP) permissions. Applies to: Windows Server 2012 R2 SummaryTwo of the three methods use Windows Management Instrumentation (WMI). One method is through the graphical user interface (GUI), and the other two methods use WMI by using a script and the WMI command-line utility, wmic. More informationTo add users or groups to Terminal Services RDP permissions, use one of the following methods. Using the GUI
Note You can't use the GUI to configure permissions to sign in to the console session with RDP. To change permissions for the console session (session zero), you must use the WMI methods below, and specify Console instead of RDP-Tcp for the terminal name. Using WMI in a scriptMicrosoft provides programming examples for illustration only, without warranty either expressed or implied. Which includes, but isn't limited to, the implied warranties of merchantability or fitness for a particular purpose. This article assumes that you're familiar with the programming language that is being demonstrated and with the tools that are used to create and to debug procedures. Microsoft support engineers can help explain the functionality of a particular procedure. However, they won't modify these examples to provide added functionality or construct procedures to meet your specific requirements. Create a script by using the following code sample: set RDPObj = GetObject("winmgmts:{impersonationLevel=impersonate}!Win32_TSPermissionsSetting.TerminalName='RDP-Tcp'") RDPobj.AddAccount "Domain\User", XWhere "Domain\User", X:
To change permissions for the console session, change the terminal name to Console instead of to RDP-Tcp. set RDPObj = GetObject("winmgmts:{impersonationLevel=impersonate}!Win32_TSPermissionsSetting.TerminalName='Console'")RDPobj.AddAccount "Domain\User", XTo revert the permissions back to the default permissions, specify the relevant terminal name. Then, call the RestoreDefaults method. set RDPObj = GetObject("winmgmts:{impersonationLevel=impersonate}!Win32_TSPermissionsSetting.TerminalName='Console'")RDPobj.RestoreDefaultsUsing the WMI command-line utility: WMIC
|