DeleteLicenseServer.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 DeleteLicenseServer 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.DeleteDirectConnectLicenseServer (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 query preferred license server settings:
QueryLicenseServers.vbs
'***************************************************************************
'
' WMI VBScript that queries the License servers configured for registry bypass.
'
' on the Terminal server
'
'***************************************************************************
for each Terminal in GetObject("winmgmts:{impersonationLevel=impersonate}").InstancesOf ("win32_TerminalServiceSetting")
WScript.Echo "The License Servers are = " & Terminal.DirectConnectLicenseServers
next
1>
|