Archive for the ‘Windows’ Category

Rename extentions

Thursday, October 30th, 2008

So we had this propriatary Java program that processed files targeted by an extention name.  When we upgraded another piece of the software, the case of the extention changed.  We could not get the source of the Java programs include files.  Temporarly we had to rename all of the files with upper case extentions.  Here is what we came up with:

For /F “tokens=1,2* delims=.” %%f In (’Dir /B *.pbs’) Do move “%%f.%%g” “%%f.PBS”

This is a batch file.  For command line only, remeber to remove one % for each variable.

Microsoft licensing just went up, big time

Friday, September 19th, 2008

We at work wanted to clearify that we don’t in fact need client access license for our 700 users if we are running 3rd party software on a Windows box.  The answer is shocking.

To start with, lets look at the license agreement.
Client Access Licensing Requirements

  • Every user or device that accesses or uses the Windows Server 2008 server software requires the purchase of a Windows Server 2008 Client Access License (Windows Server CAL) except under the following circumstances:
  • If access to the instances of server software is only through the Internet without being authenticated or otherwise individually identified by the server software or through any other means
  • If access is to Windows Web Server 2008
  • If external users are accessing the instances of server software and you have acquired a Windows Server 2008 External Connector license for each server being accessed
  • For up to two devices or users to access your instances of the server software only to administer those instances

My question was, “What constitutes server software?”  The answer I got is if you are connecting to the server, you are using Windows sockets.

A phone call to Microsoft confirmed this.

Common practice today is that if you run a service like Lotus Notes or Apache on a Windows machine, you pay for the Server OS and Lotus Notes client access licenses.  With this clarification from Microsoft, you also pay for Windows CALs.

This seems insane to me that Microsoft would take this posistion.  It makes Red Hat and Suse Linux support almost free in comparison.  Calls to the software business allience now will practically force companys to shell out hundreds of thousands to Microsoft, or convert to Linux.

Rename log file

Monday, August 11th, 2008

I needed to automate renaming log files because the size of the log file was slowing down the application. Here is the resulting batch file.

@echo off

set CURRDATE=%TEMP%\currdate.tmp

date /t > %CURRDATE%

set PARSEARG=”eol=; tokens=1,2,3,4* delims=/, ”
for /f %PARSEARG% %%i in (%CURRDATE%) do set YYYYMMDD=%%l%%k%%j

ren file.log file_%YYYYMMDD%.log

Batch file for account creation

Saturday, August 9th, 2008

A few years ago I automated account creation for an organization. Here is one of the scripts I sill use today.

echo off
REM Student extract processing script
REM
REM Finds the adds and deletes from the sasi export files
REM and saves them to adds.txt and dels.txt
REM
REM Alex trusler
REM
REM Please verify the GnuWin32 bin dir including CoreUtils,
REM DiffUtils, and Grep is in your path before executing script.
REM These tools are available at
REM gnuwin32.sourceforge.net
REM ——————————————————-

REM if %2 is NULL then display usage
if exist %2 goto else
echo —
echo —
echo usage: %0 [file1 old] [file2 new]
echo —
echo This script will save the output files
echo in your WORKING directory so change your directory
echo to your target directory.
echo —
echo Also, you can drag the batch file to the command window,
echo Then type a [space], then drag the old Stufile, [space]
echo then drage the new Stufile. Saves a lot of typing.
echo —
echo Please verify the GnuWin32 bin dir including CoreUtils,
echo DiffUtils, and Grep is in your path before executing script.
echo These tools are available at
echo gnuwin32.sourceforge.net
pause

goto eof
:else

REM compair the file from the last import to the current file.
sort %1 > temps1
sort %2 > temps2
diff –ignore-case temps1 temps2 > tempdiff

REM format and save the output
grep “> ” tempdiff | cut -b 3-100 > adds.txt

REM Cut the first 16 lines to match only the site and stu ID.
cut -b 1-16 temps1 > temps3
cut -b 1-16 temps2 > temps4
diff –ignore-case temps3 temps4 > tempdiff

REM format and save the output
grep “< ” tempdiff | cut -b 3-100 > dels.txt

REM clean up our garbage
del tempdiff
del temps1
del temps2
del temps3
del temps4

REM Tell the user the script has finished
echo Files adds.txt and dels.txt saved.

:eof