[THIN] Re: VBscript for checking User Manager settings

  • From: Wood Andrew <andy.wood@xxxxxxx>
  • To: "'thin@xxxxxxxxxxxxx'" <thin@xxxxxxxxxxxxx>
  • Date: Tue, 6 Aug 2002 08:54:53 -0000

I've a document from Microsoft - 'Using and Understanding APIs for Terminal
Server' that details all sorts of fancy dan objects that you can call from
that .dll including :-

* Performing Terminal Services administration tasks, such as enumerating and
managing Terminal Servers in a domain or enumerating and managing sessions
and processes on a Terminal Server. 
* Enhancing client/server applications in a Terminal Services environment. 
* Using Terminal Services virtual channels to communicate between client and
server components of an application. 
* Setting and retrieving Terminal-Services-specific user configuration
information. 

When I first saw it I thought you needed to do some .c coding in order to
get the information out as the documented reference calls are different from
those detailed below - but now I've got some vb examples I can spend a happy
morning rewriting some scripts :)

FWIW you can read the document on-line @

 
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/termserv/ts
ovr_2a5l.asp


-----Original Message-----
From: Jim Kenzig [mailto:jimkenz@xxxxxxxxxxxxxx] 
Sent: 05 August 2002 22:08
To: thin@xxxxxxxxxxxxx
Subject: [THIN] Re: VBscript for checking User Manager settings



Here ya go:
'the following is an example of how to modify terminal server settings 'feb
12, 2001 added SetTSConfigfAllowLogonTerminalServer (requested by Lance
Francis)
'thx to Jonathan Reininger for indepth testing

'contact bhay@xxxxxxxxxxxx for help, feedback, or donations 'script
requires:
'   wts_admin.dll to be registered
'   terminal server 4 or windows 2000
'   wtsapi32.dll (included in the above os's)

dim obj
set obj=createobject("wts_admin.functions") 'accessible after registering
wts_admin.dll

dim retval 'integer
dim server,userid,homedir,homedrive,profilepath,homedirectory 'string dim
bLogin 'boolean

'following variables required for all functions utilized in this script
server="wopr" 'domain controller or terminal server (use terminal server if
server is standalone) userid="test" 'userid to modify

' * * *          set user's profile path
profilepath="\\yourserver\someshare" 'new directory to change user's
homedirectory to.
'retval=obj.settsprofilepath(server,userid,profilepath)

' * * *          set user's home drive (requires home directory to be set
also)
homedrive="X" 'new driveto change user's homedrive to.
'retval=obj.settshomedrive(server,userid,homedrive)

' * * *          set user's home directory
homedirectory="\\myserv\myhome"
'retval=obj.SetTSHomeDirectory(server,userid,homedirectory)

' * * *          set whether user is allowed to login to terminal server
bLogin=False 'boolean value
retval=obj.SetTSConfigfAllowLogonTerminalServer(server,userid,bLogin)

'the following return value is the value returned from the api.  0=success
if retval=0 then
        wscript.echo "failure. return value: "&retval
else
        wscript.echo "success. return value: "&retval
end if

'notes:
'If the function succeeds, the return value is a nonzero value. 'If the
function fails, the return value is zero. To get extended error information,
call GetLastError. 'GetLastError not implemented at this time.  in the
future the return value will be the GetLastError value 'to test the
different functions above simply remark out those that are not used and
unremark '  the function being tested


I can't remember where I got this from but there is also a dll in the file
that you can use. See http://thethin.net/wts_admin.zip

Regards,
Jim Kenzig
http://thethin.net


-----Original Message-----
From: thin-bounce@xxxxxxxxxxxxx [mailto:thin-bounce@xxxxxxxxxxxxx]On
Behalf Of Adam_Baum@xxxxxxxxxxxxx
Sent: Monday, August 05, 2002 4:46 PM
To: thin@xxxxxxxxxxxxx
Subject: [THIN] VBscript for checking User Manager settings



Does anyone know how to read the TS Config portion of User Manager using
VBScript?  My semi-literate scripters can pretty much parse everything, but
the TS config.  They tell me they don't know the obejct info.  Since I am
not a VBer, I am not 100% sure of what they mean.

Any sample code would be much appreciated.

adam






--
This correspondence is confidential and is solely for the intended 
recipient(s). If you are not the intended recipient, you must not use, 
disclose, copy, distribute or retain this message or any part of it. If you are 
not the intended recipient please delete this correspondence from your system 
and notify the sender immediately. 

No warranty is given that this correspondence is free from any virus. In 
keeping with good computer practice, you should ensure that it is actually 
virus free. E-mail messages may be subject to delays, non-delivery and 
unauthorised alterations therefore, information expressed in this message is 
not given or endorsed by Sx3 unless otherwise notified by our duly authorised 
representative independent of this message.

Sx3 is a trading name of Service and Systems Solutions Limited, a limited 
company registered in Northern Ireland under number NI 32979 whose registered 
office is at 120, Malone Road, Belfast, BT9 5HT.



===================================
This weeks Sponsor:
triCerat, Inc
ScrewDrivers fxp: Self Configuring Printer Driver with Bandwidth Control
Learn more at:
http://www.tricerat.com/?page=products&product=sdfxp

===================================
For Archives, to Unsubscribe, Subscribe or 
set Digest or Vacation mode use the below link.

http://thethin.net/citrixlist.cfm

Other related posts: