[THIN] Re: ts profile setting

  • From: "Arthur Reyes" <ARTADMIN@xxxxxxxxxxxxx>
  • To: thin@xxxxxxxxxxxxx
  • Date: Tue, 24 Aug 2004 12:40:17 -0500

Use at own risk . . . .

Get your feet wet with vbscript

This is a variant of a script I wrote before I understood ADSI
leaf objects.  Copy to notepad and save as vbs.  Essentially,
this script is placed in a folder, along with the tsprof utility.
 It requires one argument, a list of users.  This can be easily
generated with a net user /domain redirected to a textfile, then
edited to one column.  (I should go back and make the script
split, but since it solved the problem I had at the time, I don't
need to go back and fix it, right?).  If you want to test, make a
input file with only 1 user name in it.  This script echoes
everything it is going to do.

You also need to replace any instance of <YOURDOMAIN>, and <PATH>

syntax
cscript SCRIPT.vbs file.txt

You can redirect as well
cscript SCRIPT.vbs file.txt >> log.log

What's it do?
It looks to see if a TS Profile path has been set.  If the user
object has no profile path set, the script sets it by running the
tsprof command.


------------begin script--------------
Set objArgs = WScript.Arguments
Const ForReading = 1
Set objDictionary = CreateObject("Scripting.Dictionary")
Set objFSO = CreateObject("Scripting.FileSystemObject")
Set objTextFile = objFSO.OpenTextFile(objArgs(0), ForReading)
Set objShell = WScript.CreateObject("WScript.Shell")
i = 0
Do While objTextFile.AtEndOfStream <> True
    strNextLine = objTextFile.Readline
    objDictionary.Add i, strNextLine
    i = i + 1
Loop
For Each objItem in objDictionary
    user = objDictionary.Item(objItem)
    Wscript.echo " "
    wscript.echo "tsprof /q /domain:<YOURDOMAIN> " & user
    Set objExecObject = objShell.Exec ("tsprof /q
/domain:<YOURDOMAIN> " & user)
    strText = objExecObject.StdOut.ReadLine()
    Wscript.Echo strText
    wscript.sleep 1000
'The next line is the response from tsprof if there is no Profile
Path set for the user
    if Instr(strText, "Terminal Services Profile Path for
<YOURDOMAIN>\" & user & " is {  }") > 0 Then
'Set the path, assuming the default is \\server\share\user name
    Wscript.echo "tsprof /update /domain:<YOURDOMAIN>
/profile:<PATH>\" & user & " " & user
    Set objExecObject = objShell.Exec ("tsprof /update
/domain:<YOURDOMAIN> /profile:<PATH>\" & user & " " & user)
    strText = objExecObject.StdOut.ReadLine()
    Wscript.Echo strText
    else
    wscript.sleep 1000
'Do something else if the path is already set.
    end if
Next

********************************************************
This Weeks Sponsor RTO Software
Do you know which applications are abusing your CPU and memory?
Would you like to learn? --   Free for a limited time!
Get the RTO Performance Analyzer to quickly learn the applications,
users, and time of day possible problems exist.
http://www.rtosoft.com/enter.asp?id=320
********************************************************** 
Useful Thin Client Computing Links are available at:
http://thin.net/links.cfm
***********************************************************
For Archives, to Unsubscribe, Subscribe or 
set Digest or Vacation mode use the below link:
http://thin.net/citrixlist.cfm

Other related posts: