Windows Server Recipes

Windows Server 2008

Open the Session 0 desktop

  1. Make sure the Interactive Services Detection service is running.
  2. Call:
rundll32 winsta.dll,WinStationSwitchToServicesSession

Source [2]

 Set Time Limit for Terminal Services Sessions

Registry Key:

HKEY_LOCAL_MACHINE\SOFTWARE\Policies\Microsoft\Windows NT\Terminal Services

MaxIdleTime – Time in milliseconds before the session is disconnected due to idling

MaxDisconnectionTime – Time in milliseconds before the session is logged out after disconnecting

Source [2]

Windows Server 2012

To Configure Remote Desktop

  1. Open Server Manager
  2. On left panel click “Local Server”
  3. In the “Properties” window, find “Remote Desktop.” It should say “Disabled.” Click the word “Disabled.”
  4. A System Properties dialog should open. Choose “Allow remote connections to this computer.”
  5. A popup should appear saying “Remote Desktop Firewall exception will be enabled.” Click OK — note this will allow you to connect to the server via any computer on the LAN. If you want to fine-tune this, you would have to create firewall rules to do so.
  6. Note: If you are having problems connecting remotely, you may need to go back to this screen and un-check “Allow connections only from computers running Remote Desktop with Network Level Authentication”.
  7. Click OK
  8. You can now connect to the server remotely via RDP

To connect to the server via Remote Desktop

In Windows 7

  1. Go to Start->All Programs->Accessories->Remote Desktop Connection

  2. In Computer, type the NetBIOS name, or IP address of the server

  3. Click Connect

  4. Choose “Use Another Account”

  5. For username, enter the Administrator account in the form: DOMAIN\Administrator, where DOMAIN is the domain you created while enabling Active Directory (e.g. mycompany.com)

  6. Enter the administrator password

To make a Windows Server 2012 machine a domain controller

  1. Open Server Manager
  2. On left panel click “Local Server”
  3. Scroll down to “Roles and Features”
  4. On the right, click “Tasks”
  5. Click “Add Roles and Features”
  6. Follow any instructions on “Before you Begin” — i.e. update your system.
  7. Click Next
  8. Choose “Role-based or feature-based installation”, click Next
  9. Choose your server, click Next
  10. Select “Active Directory Domain Services”
  11. In the popup window, click “Add Features,” making sure that “Add Management Tools (if applicable” is checked
  12. Click Next until you come to “Confirmation” on the left hand side
  13. Click “Install”
  14. Click “Close”
  15. Reboot
  16. Open Server Manager again
  17. At the top is a yellow flag (notification). If you click it, it will tell you that “Post Deployment Configuration of Active Directory Domain Services” is required.
  18. Click “Promote this server to a domain controller”
  19. In “Deployment Configuration,” choose “Add a new forest”.
  20. Choose a root domain name (e.g. mycompany.com)
  21. Click Next
  22. For Capabilities, you may leave defaults, and enter a password for “DSRM”
  23. You may get warnings that the authoritative parent zone cannot be found, just click Next
  24. Give the machine a NetBIOS name
  25. Click “Next” for paths (unless you need to set custom paths for the databases and log files because you don’t have enough space on your C drive)
  26. Review options and click Next
  27. Review and fix any prerequisites
  28. Click Install

Joining a domain with a Windows 7 computer

On Windows 7 Professional (Home edition cannot join a domain):

  1. Make sure your adapter is configured to use the domain controller machine for DNS (Control Panel->Network and Internet->Network Connections->Properties->IPv4->Preferred DNS Server, enter IP address of server)

  2. Go to Start menu

  3. Right-click Computer and choose Properties

  4. Click “Advanced system settings”

  5. Click “Computer Name” tab

  6. Next to “To rename this computer or change its domain or workgroup, click Change,” click “Change…”

  7. Give the computer a name that will be used on the server to keep track of it

  8. Under “Member Of,” choose “Domain”

  9. Enter the domain name you chose while enabling Active Directory (e.g. mycompany.com)

  10. You will be prompted for an Administrator account in the domain.

  11. For username, enter the Administrator account in the form: DOMAIN\Administrator, where DOMAIN is the domain you created while enabling Active Directory (e.g. mycompany.com)

  12. Click OK and reboot

  13. When the machine restarts, you can log in as a domain user (see “Creating Accounts in Active Directory”)

Creating Accounts in Active Directory

You will want to create accounts in the domain. These will be used on the computers in the domain itself. You can also give domain administrator privileges to those users who will be responsible for administrating the LAN and server.

  1. On your server, go to Control Panel, and “Active Directory Users and Computers”

  2. Expand your domain, find the “Users” folder, and right-click it.

  3. Choose New->User

  4. Enter the user’s information, and give them a logon name

  5. Click Next

  6. Choose a password, and any password options you wish to apply to that user

  7. Click Next

  8. Click Finish

To promote a user to a Domain Administrator

  1. On your server, go to Control Panel, and “Active Directory Users and Computers”

  2. Expand your domain, find the “Users” folder, and right-click it

  3. Find the user you wish to promote

  4. Double click the name

  5. Under “Member Of,” choose “Add…”

  6. In the text box “Enter the object names to select,” type “Domain Admins”

  7. Click “Check Names,” and make sure that the text you just typed becomes underlined (if it doesn’t, you probably made a typo)

  8. Click OK

  9. Click OK again

To enable sharing of a workstation through the domain administrator

On Windows 7

  1. Make sure your firewall is turned off (Control Panel->System and Security->Windows Firewall), or that you have the appropriate firewall configuration to allow CIFS shares. If you’re on a LAN, your machines generally don’t need an external firewall

  2. Go to Control Panel->Network and Internet->Network And Sharing Center->Advanced Sharing Settings

  3. Expand Domain

  4. Choose Turn on File and Printer Sharing

  5. Administrative shares should automatically be shared, so if you are a domain admin you should be able to access the workstations c: drive from any other computer in the domain using \\192.168.3.4\c$, where 192.168.3.4 is the machine’s IP address

  6. If you want to be able to use names, you will most likely either need to have DHCP configured for your server, or configure the names using the server’s DNS.

Windows Server 2012r2

How to fix RDS 2012r2 error: “Licensing mode for the Remote Desktop Session Host is not configured.”

In PowerShell:


$obj = gwmi -namespace "Root/CIMV2/TerminalServices" Win32_TerminalServiceSetting
$obj. SetSpecifiedLicenseServerList("licserver.domain.local")

Replace licserver.domain.local with the fully-qualified host name of your license server.

Next, edit the following registry key:


HKLM\SYSTEM\CurrentControlSet\Control\Terminal Server\RCM\Licensing Core\LicensingMode

Use DWORD of 2 if you use “Per Device,” licenses or 4 for “Per User” licenses.

Finally, reboot your server.

Source

License Server Shows Installed License Quantity, with 0 licenses available

->Deactivate the LS

->Remove the Licensing role

->Restart the server

->Renamed the existing lserver folder to .old (c:\windows\system32\)

->Install the licensing role

->lserver folder will be created automatically

->Activate the License server

->install the licenses using EA agreement number

Source

If the Licenses Won’t Reinstall…

My licenses wouldn’t reinstall, because I had changed so many settings attempting to find out why my licenses hadn’t installed.  So, I also needed to migrate licenses from the Remote Desktop Licensing manager:

In Server Manager, go to Tools->Terminal Services->Remote Desktop Licensing Manager

Right-click the license server (in the left-hand pane), and click “Manage Licenses,” and click Next on the dialog.

Click “Migrate licenses from another server to this server”

As reason, choose “The source license server is no longer functioning”