Use the following WMI script to set a preferred license server:
AddLicenseServer.vbs
'***************************************************************************
'
' WMI VBscript to add a specified License server to Terminal server's registry
'
'***************************************************************************
if Wscript.arguments.count<1 then
Wscript.echo "Script requires one argument, the LicenseServerName"
Wscript.echo "e.g. cscript AddLicenseServer LicenseServerName"
Wscript.quit
end if
Dim strServer
strServer=Wscript.arguments.Item(0)
for each terminal in GetObject("winmgmts:{impersonationLevel=impersonate}").InstancesOf ("win32_TerminalServiceSetting")
result = terminal.AddDirectConnectLicenseServer (strServer)
WScript.Echo "Method returned result = " & result
if err <>0 then
WScript.Echo Err.Description, "0x" & Hex(Err.Number)
end if
next
Use the following WMI script to delete preferred license servers:
1>
|