Friday, February 28, 2014

Make sure you're clear to change your password

The following script I use to verify that I am not logged in anywhere else before I change my domain password.

@echo off
set me=logon

for /F %%S in (myservers.txt) do (@echo %%S && @query session /SERVER:%%S | find "%me%")

  • Change `me` to your domain logon
  • create myservers.txt with a list of the servers you want to limit your search to, then save it in the same folder as this script.

Cheap Portal Monitor

Below is a script that I use to check that the portals are running and errors are not present. Sometime services lie!

@echo off
cls
SETLOCAL ENABLEDELAYEDEXPANSION ENABLEEXTENSIONS
set pre=http://
set sufix=^.domain^.org/lawson/portal
set lbpsufix=^.domain^.root^.loc/lbp9
set lbisufix=^.domain^.root^.loc:9080/efs/
:: Inteded to have wget installed on host pc
set wgetpath=C:\wget\bin
:: intended to be run from USB drive
set locroot=%~dp0
rem <esc>[<attribute>;<foreground>;<background>m
set yellow=[1;33;40m
set cyan=[1;36;40m
set red=[1;31;40m
set normal=[0;32;40m

goto start

:start
cd %locroot%\scripts\Infor\
@del /Q h*.tmp.txt && @cls
@del /Q index.html.* && @cls
@del /Q out.*txt && @cls
@del /Q final.txt && @cls
@del /Q finalf.txt && @cls
@del /Q SSOServlet@_action* && @cls
@del /Q null && @cls
goto:flow

:flow
for %%M in (server1 server2) do call :verportal %%M
for %%N in (server3 server4) do call :verportal1 %%N
for %%O in (server5 server6) do call :verportal2 %%O
@cls
call :doublecheck
call :display
goto:EOF

:verportal
%wgetpath%\wget %pre%%1%sufix% 1>nul 2>"%1.tmp.txt"
find /c "connected" "%1.tmp.txt" >NULL
if %errorlevel% equ 1 goto notthere
goto:end

:verportal1
%wgetpath%\wget %pre%%1%lbpsufix% 1>nul 2>"%1.tmp.txt"
set result=("type "%1.tmp.txt" | @find /i "connecting" | @find /i "connected"")
find /c "connected" "%1.tmp.txt" >NULL
if %errorlevel% equ 1 goto notthere
goto:end

:verportal2
%wgetpath%\wget %pre%%1%lbisufix% 1>nul 2>"%1.tmp.txt"
set result=("type "%1.tmp.txt" | @find /i "connecting" | @find /i "connected"")
find /c "connected" "%1.tmp.txt" >NULL
if %errorlevel% equ 1 goto notthere
goto:end

:notthere
echo ------- FAILURE reaching page!!!!
goto:end

:doublecheck
echo Checks to see if 200 OK was received ^| 1 = was received
for /r %%B in ("h*.tmp.txt") do (@find /c "200 OK" %%B) >> out.txt
for /r %%C in (out.txt) do (@type out.txt | @findstr /E /R /X ".*1$" >> final.txt)
for /r %%D in (out.txt) do (@type out.txt | @findstr /E /R /X ".*0$" >> finalf.txt)
goto:end

:display
for /F "delims=\ tokens=4,5" %%E in (final.txt) do @echo %cyan% %%E
for /F "delims=\ tokens=4,5" %%F in (finalf.txt) do @echo %red% %%F
goto:end

:end
@echo %normal%

:EOF
endlocal
exit /B
-

Output looks like:

Checks to see if 200 OK was received | 1 = was received
 server1.TMP.TXT: 1
 server2.TMP.TXT: 1
 server3.TMP.TXT: 1
 server4.TMP.TXT: 1
 server5.TMP.TXT: 1
 server6.TMP.TXT: 0

F:\scripts\Infor>

Wednesday, September 18, 2013

One Liners: Sys Admin



  • To get a list of the applications using the most memory: tasklist | sort /+65 /R | more
  • To get the date your password will expire: net user %USERNAME% /domain | find /i "expires"



Thursday, February 07, 2013

Testing tools

Found a few sites that have great links to resources: opensourcetesting.org & softwareqatest.com.

I'm trying Log Parser Studio and have tried Splunk.

I've evaluated Telerik's Test Studio and was very impressed, but it's not something I can afford out of my pocket.

I've gotta say that if I can't persuade my employer to purchase PowerGREP I may pay for it myself. It does a lot when you need to look through and report on a variety of logs (WebSphere, IIS, Apache, DB2, SQL, vendor specific...). It uses regular expression or literal text and does collection that can be raw or grouped using a variety of methods.

Monday, February 04, 2013

Lawson Cleanup

Lawson Cleanup

The following are compiled from several resources and are in no particular order:



deljobhst -cjrw delete everything over 90 days
delusers delete orphaned users
jobinteg -vd
secinteg
permsmaint



Thursday, January 17, 2013

RegEx Examples

Regular Expression Examples

Text Log Extractions

Multi-Line

^2013-01-16.{1,}16:[0-9]{2}:[0-9]{2}.+\)\x0AUSER:\s000000\x0Afinished\s.+ACCESS\sDENIED\x0a$

Breakdown:
^   Start Multi-line pattern
2013-01-16.{1,}16:[0-9]{2}:[0-9]{2}   Date stamp
.+   any character 1 or more times
\)   specific character ) could use \x29 or \051
\x0A  New line could be \n

USER:   beginning of next line starts with USER:
\s   There's white space
000000  looks for specific number sequence
\x0A  New line could be \n
finished   beginning of next line starts with finished
\s   There's white space
.+   any character 1 or more times
ACCESS\sDENIED   finds `ACCESS DENIED`
\x0A   New line could be \n
$   end of multi-line pattern

To get the UID, token and action that was denied:

^(USER:\s)([0-9]{6})(\r\n|\n)(.+tokenName=)(([A-Z]{2}[0-9]{2,3}\.[0-9]{1})|([A-Z]{2}[0-9]{2,3}))(.+actionCode=)([A-Z]{1})(:.+DENIED)$
Collect: $2,$5,$9\n
will return:        000000,GL124,I

How it works:
^ starts the multi-line pattern
(USER:\s) looks for the user
([0-9]{6}) gets the UID
(\r\n|\n) looks for the line break
(.+tokenName=) looks for the token
(([A-Z]{2}[0-9]{2,3}\.[0-9]{1})|([A-Z]{2}[0-9]{2,3})) gets the token
(.+actionCode=) looks for the action
([A-Z]{1})gets the action
(:.+DENIED) filters only the DENIED messages
$ ends the multi-line string

Reflecting on Service

I was US Army Airborne Field Artillery - Target Acquisition. I never was in combat, so I don't think of myself as a veteran, but I do th...