Remote Desktop Serviceは、非常に優れた機能です。 さて今回は、 以下のような状況の対処に関してPowerShellでズバッと解決してみましょう。
- WorkGroup環境にRemote Desktop License Serverをインストールし、 Remote Desktop CALを追加して動作も出来た!
- Server Managerを起動すると「ライセンスモードは構成されていません」と表示される
- RDライセンス診断機能でも同様に「ライセンスモードは構成されていません」
なんだか、 Domainが前提だからなどというそういうことじゃないんだよ回答もあるようですが、 WorkGroupでも問題ありません。
RDライセンス診断機能にて「ライセンスモードは構成されていません」との報告が出る
今回そのやり方を紹介します。
コード
まずは結論から。
Remote Desktop License Mangerなど最低限必要なモジュールを入れてRemote Desktop CALまで入力した状態してから、以下のコードを入力します。
(Get-WmiObject -Class Win32_TerminalServiceSetting -Namespace root\cimv2\TerminalServices) #モードが5 (Get-WmiObject -Class Win32_TerminalServiceSetting -Namespace root\cimv2\TerminalServices).ChangeMode(4) (Get-WmiObject -Class Win32_TerminalServiceSetting -Namespace root\cimv2\TerminalServices) #モードが4 New-ItemProperty "HKLM:\SYSTEM\CurrentControlSet\Services\TermService\Parameters\LicenseServers" -Name SpecifiedLicenseServers -Value "localhost" -PropertyType MultiString #localhostをサーバーに指定 Get-ItemProperty "HKLM:\SYSTEM\CurrentControlSet\Services\TermService\Parameters\LicenseServers" -Name SpecifiedLicenseServers #サーバー設定の確認
RDライセンス診断機能で確認して、エラーが無くなっているのが確認できるはずです。
簡単に説明
コードのそれぞれを軽く説明します。
以下は現在のTerminalServiceのモードを表示します。エラーが出ていた時は以下の結果のはずです。
PS> (Get-WmiObject -Class Win32_TerminalServiceSetting -Namespace root\cimv2\TerminalServices) __GENUS : 2 __CLASS : Win32_TerminalServiceSetting __SUPERCLASS : CIM_Setting __DYNASTY : CIM_ManagedSystemElement __RELPATH : Win32_TerminalServiceSetting.ServerName="SERVERNAME" __PROPERTY_COUNT : 53 __DERIVATION : {CIM_Setting, CIM_ManagedSystemElement} __SERVER : SERVERNAME __NAMESPACE : root\cimv2\TerminalServices __PATH : \\WHITE-DEPLOY-IP\root\cimv2\TerminalServices:Win32_TerminalServiceSetting.ServerName="SERVERNAME" ActiveDesktop : 0 AllowTSConnections : 1 Caption : DeleteTempFolders : 1 Description : DirectConnectLicenseServers : DisableForcibleLogoff : 1 EnableAutomaticReconnection : 1 EnableDFSS : 1 EnableDiskFSS : 1 EnableNetworkFSS : EnableRemoteDesktopMSI : 1 FallbackPrintDriverType : 0 GetCapabilitiesID : 196608 HomeDirectory : InstallDate : LicensingDescription : LicensingName : LicensingType : 5 LimitedUserSessions : 0 Logons : 0 Name : NetworkFSSCatchAllWeight : NetworkFSSLocalSystemWeight : NetworkFSSUserSessionWeight : PolicySourceAllowTSConnections : 0 PolicySourceConfiguredLicenseServers : 0 PolicySourceDeleteTempFolders : 0 PolicySourceDirectConnectLicenseServers : 0 PolicySourceEnableAutomaticReconnection : 0 PolicySourceEnableDFSS : 0 PolicySourceEnableRemoteDesktopMSI : 0 PolicySourceFallbackPrintDriverType : 0 PolicySourceHomeDirectory : 0 PolicySourceLicensingType : 0 PolicySourceProfilePath : 0 PolicySourceRedirectSmartCards : 0 PolicySourceSingleSession : 0 PolicySourceTimeZoneRedirection : 0 PolicySourceUseRDEasyPrintDriver : 0 PolicySourceUseTempFolders : 0 PossibleLicensingTypes : 12 ProfilePath : RedirectSmartCards : 1 ServerName : SERVERNAME SessionBrokerDrainMode : 0 SingleSession : 1 Status : TerminalServerMode : 1 TimeZoneRedirection : 0 UseRDEasyPrintDriver : 1 UserPermission : 0 UseTempFolders : 1 PSComputerName : SERVERNAME
これを、以下のコードで4に変更します。
PS> (Get-WmiObject -Class Win32_TerminalServiceSetting -Namespace root\cimv2\TerminalServices).ChangeMode(4) __GENUS : 2 __CLASS : __PARAMETERS __SUPERCLASS : __DYNASTY : __PARAMETERS __RELPATH : __PROPERTY_COUNT : 1 __DERIVATION : {} __SERVER : __NAMESPACE : __PATH : ReturnValue : 0 PSComputerName :
再度、現在のTerminalServiceのモードを表示します。表示が変わっているでしょう。
PS> (Get-WmiObject -Class Win32_TerminalServiceSetting -Namespace root\cimv2\TerminalServices) __GENUS : 2 __CLASS : Win32_TerminalServiceSetting __SUPERCLASS : CIM_Setting __DYNASTY : CIM_ManagedSystemElement __RELPATH : Win32_TerminalServiceSetting.ServerName="SERVERNAME" __PROPERTY_COUNT : 53 __DERIVATION : {CIM_Setting, CIM_ManagedSystemElement} __SERVER : SERVERNAME __NAMESPACE : root\cimv2\TerminalServices __PATH : \\WHITE-DEPLOY-IP\root\cimv2\TerminalServices:Win32_TerminalServiceSetting.ServerName="SERVERNAME" ActiveDesktop : 0 AllowTSConnections : 1 Caption : DeleteTempFolders : 1 Description : DirectConnectLicenseServers : DisableForcibleLogoff : 1 EnableAutomaticReconnection : 1 EnableDFSS : 1 EnableDiskFSS : 1 EnableNetworkFSS : EnableRemoteDesktopMSI : 1 FallbackPrintDriverType : 0 GetCapabilitiesID : 196608 HomeDirectory : InstallDate : LicensingDescription : このポリシーでは、リモート デスクトップ セッション ホスト サーバーに接続する ユーザー 1 人につきライセンスが 1 つ発行される必要があります。ライセンスをユ ーザーに割り当てることは、現在管理されていません。 LicensingName : 接続ユーザー数 LicensingType : 4 LimitedUserSessions : 0 Logons : 0 Name : NetworkFSSCatchAllWeight : NetworkFSSLocalSystemWeight : NetworkFSSUserSessionWeight : PolicySourceAllowTSConnections : 0 PolicySourceConfiguredLicenseServers : 0 PolicySourceDeleteTempFolders : 0 PolicySourceDirectConnectLicenseServers : 0 PolicySourceEnableAutomaticReconnection : 0 PolicySourceEnableDFSS : 0 PolicySourceEnableRemoteDesktopMSI : 0 PolicySourceFallbackPrintDriverType : 0 PolicySourceHomeDirectory : 0 PolicySourceLicensingType : 0 PolicySourceProfilePath : 0 PolicySourceRedirectSmartCards : 0 PolicySourceSingleSession : 0 PolicySourceTimeZoneRedirection : 0 PolicySourceUseRDEasyPrintDriver : 0 PolicySourceUseTempFolders : 0 PossibleLicensingTypes : 12 ProfilePath : RedirectSmartCards : 1 ServerName : SERVERNAME SessionBrokerDrainMode : 0 SingleSession : 1 Status : TerminalServerMode : 1 TimeZoneRedirection : 0 UseRDEasyPrintDriver : 1 UserPermission : 0 UseTempFolders : 1 PSComputerName : SERVERNAME
レジストリにLicenseServerはlocalhost (つまり自分だよ)と追加します。
PS> New-ItemProperty "HKLM:\SYSTEM\CurrentControlSet\Services\TermService\Parameters\LicenseServers" -Name SpecifiedLicenseServers -Value "localhost" -PropertyType MultiString SpecifiedLicenseServers : {localhost} PSPath : Microsoft.PowerShell.Core\Registry::HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\TermService\Parameters\LicenseServers PSParentPath : Microsoft.PowerShell.Core\Registry::HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\TermService\Parameters PSChildName : LicenseServers PSDrive : HKLM PSProvider : Microsoft.PowerShell.Core\Registry
最後に現在のレジストリ値を確認します。
PS> Get-ItemProperty "HKLM:\SYSTEM\CurrentControlSet\Services\TermService\Parameters\LicenseServers" -Name SpecifiedLicenseServers SpecifiedLicenseServers : {localhost} PSPath : Microsoft.PowerShell.Core\Registry::HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\TermService\Parameters\LicenseServers PSParentPath : Microsoft.PowerShell.Core\Registry::HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\TermService\Parameters PSChildName : LicenseServers PSDrive : HKLM PSProvider : Microsoft.PowerShell.Core\Registry
まとめ
Remote Desktop ServiceがDomain環境でないと追加できないとか謎回答は辞めましょう。 Windowsに置いて、 Domainは色々な基盤となるのは周知の通りですが、出来るものもありますので。
そしてレジストリの操作はPowerShellで。以前のようなレジストリファイルを作るなど不要ですと言い切りたいです。