PowerShell Error - "Invalid operation "

Hi, I am getting below error when I am trying to set RD licensing server.
with below command. Please help to fix this issue.

PS C:> $obj = gwmi -namespace “Root/CIMV2/TerminalServices” Win32_TerminalServiceSetting
PS C:> $obj.SetSpecifiedLicenseServerList(“LicensingServerName”)
Exception calling “SetSpecifiedLicenseServerList” : "Invalid operation "
At line:1 char:1

  • $obj.SetSpecifiedLicenseServerList("LicensingServerName …
  •   + CategoryInfo          : NotSpecified: (:) [], MethodInvocationException
      + FullyQualifiedErrorId : WMIMethodException

Try Googling setspecifiedlicenseserverlist powershell invalid operation The result set is a huge list. Typically look at entries on the first page of Google results.

The first result shows several things for you to check.