vbscript > how to set tscc.msc/server settings/licensing to per user via vbscript
-
Tuesday, October 09, 2012 6:47 PM
Hello ,
Can someone help me in creating a vbscript with the following:
Go to > Start > Run , type in tscc.msc, hit enter In Terminal Services Configuration go to the Server Settings folder. double click the Licensing Setting and change the Licensing Mode to Per User. click OK to close and log out.
need this urgently so any kind of help or advise on this matter will be greatly appreciated
Kind regards,
Gabe
All Replies
-
Tuesday, October 09, 2012 6:50 PMModerator
Hi,
Please read the following:
Bill
-
Tuesday, October 09, 2012 6:57 PM
Hi,
Please read the following:
Bill
o
-
Tuesday, October 09, 2012 8:27 PM
Hello ,
Can someone help me in creating a vbscript with the following:
Go to > Start > Run , type in tscc.msc, hit enter In Terminal Services Configuration go to the Server Settings folder. double click the Licensing Setting and change the Licensing Mode to Per User. click OK to close and log out.
need this urgently so any kind of help or advise on this matter will be greatly appreciated
Kind regards,
Gabe
Cannot be done via VBScript.
To change licensing mode you need to call the Microsoft licensing center for instuctions.
¯\_(ツ)_/¯
-
Wednesday, October 10, 2012 2:46 PM
I think it can be done , i only need a bit of help in sorting some of the code ....
look, here is what i have managed to think off so far :
Const tscc.msc = 1 ( a constant needs to be defined for rest of code to take effect )
strComputer = "."
Set obj(not sure on obj define) = GetObject("winmgmts:\\" & _
strComputer & "\root\cimv2")
strKeyPath = "%SystemRoot%\system32\tscc.msc /s" ( this will automatically open for me tscc.msc - i do not know however how to path server settings /licensing once tscc.msc is opened )strValueName = "
obj(not sure on obj define).SetValue tscc.msc , strKeyPath, strValueName
If any one has any idea on the above trow it in , dont be shy
-
Wednesday, October 10, 2012 2:52 PMModerator
Hi,
You are assuming that a simple registry value change will do what you want.
Have you researched this? If so, what search terms did you use, and with what results?
Bill
-
Wednesday, October 10, 2012 5:08 PM
I think it can be done , i only need a bit of help in sorting some of the code ....
look, here is what i have managed to think off so far :
Const tscc.msc = 1 ( a constant needs to be defined for rest of code to take effect )
strComputer = "."
Set obj(not sure on obj define) = GetObject("winmgmts:\\" & _
strComputer & "\root\cimv2")
strKeyPath = "%SystemRoot%\system32\tscc.msc /s" ( this will automatically open for me tscc.msc - i do not know however how to path server settings /licensing once tscc.msc is opened )strValueName = "
obj(not sure on obj define).SetValue tscc.msc , strKeyPath, strValueName
If any one has any idea on the above trow it in , dont be shy
If you read teh documentation carefully it expalins that you cannot change licesing mode without contacting the Microwsoft licensing center except for on initial change which has to be done at teh console and then a restart of teh system is necessary.
Once device licenses are given out I am pretty sure that you can only do this by manually resetting the license server and reregistering it with MS after you have the liocense center reset your licenses online.
Remember that TS licensing is an online event.
These issues may be differnt if we use multiple license servers but then you would still not want to do a registry reset.
Try contacting Microsoft TS licensing center and ask them the best way to procee. They are usually very helpful and there is has been no charge any time I have contacted them.
See: http://technet.microsoft.com/en-us/library/cc786109(v=ws.10).aspx
¯\_(ツ)_/¯
- Edited by jrvMicrosoft Community Contributor Wednesday, October 10, 2012 5:14 PM
-
Wednesday, October 10, 2012 5:10 PM
Here are the official Microsoft methods of changing llicensing mode along with any caveats.
http://technet.microsoft.com/en-us/library/cc786109(v=ws.10).aspx
¯\_(ツ)_/¯
- Marked As Answer by IamMredMicrosoft Employee, Owner Sunday, October 14, 2012 12:19 AM
-
Wednesday, October 10, 2012 5:13 PM
hi Bill and thanks for answering .... I have done extensive research on this subject for over a week now , including checks on how the OS is deployed and how the tscc is installed , setup and executed as an managing tool in server OS ;this way I was able to determine exact execution path in order to shorten the code line as much as possible . Automating this have not been tried before and I thought this to be an interesting way of shortening work when you have several servers to attend to each day and with different problems ( this being the minor one of the lot ).
So reviewing the execution process in parallel with script lines :
1. Go to > Start > Run , type in tscc.msc, hit enter ; this opens up tscc
code to do so :
Const tscc.msc = 1
strComputer = "."
Set objWMIService = GetObject("winmgmts:\\" & _ strComputer & "\root\cimv2")
strKeyPath = "%SystemRoot%\system32\tscc.msc /s"2. In Terminal Services Configuration go to the Server Settings folder. double click the Licensing Setting and change the Licensing Mode to Per User. click OK to close and log out.
now this is where i got stuck: once the script opens up tscc , needs to go to server settings folder and change the value for licensing to Per User
Well , here is where I need some help from you guys to fill in the blanks . Do I need to define a secondary path so the script can go to server settings/licensing? if so , how those the code layout looks like ? Is there another way on how to change to desired setting , considering that " Per User" is a value name , "Licensing " acts as a reg key and "Server Settings" is basically a folder containing this reg key ?
-
Wednesday, October 10, 2012 5:18 PMModerator
Hi,
Sorry, but what you posted makes almost no sense. Specifying a registry key path has nothing to do with opening an MMC console.
Also, I recommend you read and understand the documentation. jrv posted the link for you.
Bill
-
Wednesday, October 10, 2012 5:47 PM
Gabriel -
Thsi is not a registry key path. It is a file system path to teh MMC program.
strKeyPath = "%SystemRoot%\system32\tscc.msc /s"
You cannot use this ina ny meaningful way to change the setting. Uset the Microsoft "Recommended" and "Best Practices" method.
The issue is that the setting is not likely a specific single registry key. This is why Microsoft has not documented this cahnge or provided a good way to script it. It is not a switch that should be altered without thinking about what it will do. If you had researched this you would have found this to be true.
If you are having issues with TS then see this KB:
http://support.microsoft.com/kb/834651
¯\_(ツ)_/¯
-
Thursday, October 11, 2012 2:31 PM
thanks jrv , this actually makes sense .
So, based on the logic found in the microsoft link , i was able to create following 2 scripts :
1. script to remove faulty subkey from reg:
Const HKEY_LOCAL_MACHINE = &H80000002
strComputer = "."
Set objRegistry = GetObject("winmgmts:\\" & _
strComputer & "\root\default:StdRegProv")
strKeyPath = "System\CurrentControlSet\Control\TerminalServer\Licensing Core\"
strValueName = "PolicyAcOn"
objRegistry.DeleteValue HKEY_LOCAL_MACHINE, strKeyPath, strValueName
Wscript.echo "subkey deleted"
End Function2. script to change LicensingType from Per Device to Per User :
strComputer = "."
Set objWMIService = GetObject("winmgmts:" _
& "{impersonationLevel=impersonate}!\\" &
strComputer & "\root\cimv2")
Set colItems = objWMIService.ExecQuery("Select *
from Win32_TerminalServiceSetting")
For Each objItem in colItems
objItem.LicensingType = 4 'Enable Per User
objItem.Put_
Next
Wscript.echo "Terminal Services Server and
Connection Settings Optimized"
End Functionset to run in this order , the faulty subkey is first removed , then second script re-writes the subkey with the desired value which is 4 and changes the licensing type to per user , thus solving this issue that was driving me crazy for the past week :))
-
Thursday, October 11, 2012 2:58 PM
You could also have just downloaded and run the hotfix which is basically a script that does what you did but I believe it also check a couple of other issues frist such as tewting if the issue is really the one caused by the bug.
The issue here appears to not be one of changing mode ; but one of a bug fix.
You should set your license mode using GP as it will prevent this from happening.
¯\_(ツ)_/¯
- Marked As Answer by IamMredMicrosoft Employee, Owner Sunday, October 14, 2012 12:19 AM

