[THIN] Re: Need Command Line tool

  • From: "Matt Kosht" <matt.kosht@xxxxxxxxxxxxxx>
  • To: <thin@xxxxxxxxxxxxx>
  • Date: Wed, 22 Sep 2004 14:42:41 -0400

I'll second that.

I'll even chip in this cheesy perl program that does a search and
replace recursively through a profile root. All this for $9.95 plus I
throw in a set of Ginsu steak knives! 

You can compile it to a standalone EXE (no Perl interpreter required)
with Indigo Star's PERL2EXE

http://www.indigostar.com/perl2exe.htm 

I used this from network login script to hit each users' PC

#***citrixini.pl
# This program needs to be run from the profile root!!!
# (winNT) = c:\wtsrv\profiles\
# (win2k) = c:\Documents and Settings\

  use File::DosGlob;

  $myDir = substr($0, 0, rindex($0, "\\") + 1);
  $myFile = substr($0, rindex($0, "\\") + 1, length($0));

  if (open LOG, ">citrixini.log") {
    print "Logging status to: citrixini.log\n";
    $logging = 1;
  }
  else {
    print "Error opening citrixini.log!  Results will not be
logged!\n";
    $logging = 0;
  }


  print "This program needs to be run from the profile root!!!\n";
  print "(winNT) = c:\\wtsrv\\profiles\\\n";
  print "(win2k) = c:\\Documents and Settings\\\n\n";
  print "Press any key to continue...\n";
  my $retval = `pause`;
  if ($logging) {
    print LOG "Logging run to: citrixini.log\n";
    my $time = localtime(time);
    print LOG "Logging started: $time\n\n";
    print LOG "This program needs to be run from the profile
root!!!\n";
    print LOG "WinNT = c:\\wtsrv\\profiles\\\n";
    print LOG "Win2k = c:\\Documents and Settings\\\n\n";
  }


  my @files = `dir /b`;
  foreach my $file (@files) {
    chop $file;
    if (chdir($file)) {
      print "Changing appsrv.ini for profile $file...";
      if ($logging) {
        print LOG "Changing citrix appsrv.ini for profile $file...";
      }
      &changeINI("Application Data\\ICAClient\\appsrv.ini");
      chdir("..");
    }
  }
  print "\nAll files have been processed, program terminated.\n";
  if ($logging) {
    print "Results can be found in logfile: citrixini.log\n";
    print LOG "\nAll files have been processed, program
terminated.\n";
    print LOG "Results can be found in logfile: citrixini.log\n";
    my $time = localtime(time);
    print LOG "\nLogging ended: $time\n\n";
    close LOG;
  }
  print "Press any key to exit...";
  my $retval = `pause`;
exit(0);

sub changeINI {
  my $filename = @_[0];
  if (open INI, "<$filename") {
    my @filedata = <INI>;
    close INI;
    if (open INI, ">$filename") {
      foreach my $line (@filedata) {
        if (index($line, "TcpBrowserAddress=") >= 0) {
            $line = "TcpBrowserAddress=192.168.0.100\n";
        }
        if (index($line, "TcpBrowserAddress2=") >= 0) {
            $line = "TcpBrowserAddress2=192.168.0.101\n";
        }
        if (index($line, "TcpBrowserAddress3=") >= 0) {
            $line = "TcpBrowserAddress3=192.168.0.102\n";
        }
        print INI $line;
      }
      print "done.\n";
      if ($logging) {
        print LOG "done.\n";
      }
    }
    else {
      print "error opening appsrv.ini for writing!\n";
      if ($logging) {
        print LOG "error opening appsrv.ini for writing!\n";
      }
    }
  }
  else {
    print "error opening appsrv.ini for reading!\n";
    print LOG "error opening appsrv.ini for reading!\n";
  }
}
#***citrixini.pl



>>> Mark.Landin@xxxxxxxxxxxxxxxx 09/22/2004 1:58:50 PM >>>
Perl, of course.


________________________________

        From: thin-bounce@xxxxxxxxxxxxx 
[mailto:thin-bounce@xxxxxxxxxxxxx] On Behalf Of Stratton, Doug MSER:EX
        Sent: Wednesday, September 22, 2004 12:03 PM
        To: 'thin@xxxxxxxxxxxxx' 
        Subject: [THIN] Need Command Line tool
        
        

        For updating appsrv.ini and pn.ini. 

        We are going to move our servers into another farm and we think
the way to go with the clients it to modify the appsrv.ini and pn.ini
to
reflect the new farm name/location info.

        What I need is a tool I can run from a batch file that will do
a
search replace/or add to specific location in the ini files.

        Any recommendations? 

        Thanks 

        Doug Stratton
        Operations Engineering
        Workstations Services Branch
        CITS, Solutions BC, Province of BC
        4000 Seymour Place, Victoria  B.C.
        Telephone: (250) 356-6678 
        Email: Doug.M.Stratton@xxxxxxxxxxxxxxx 


********************************************************
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: