Relaunching a windows app using a batch script

We recently had need to restart an app server exe automatically when the demonstration license it was running on caused the server to close regularly, annoying everyone trying to learn the system. We had need of a script (YAY) to check if it was running and restart it when required.

Requirements:

  1. Check to see if the app is running on start if not running, start it.
  2. wait for some period of time (60 seconds)
  3. Check to see if the app is running, if not running, start it

Flourishes:

  1. Date app last restarted is displayed in title
  2. ability to close script with a button press
  3. ability to cancel wait time and relaunch app now
  4. ability to log when app was restarted

Working on it:

checking if a process is running:

It turns out that checking if a process is running is relatively easy:

tasklist /FI "IMAGENAME eq appServer.exe" | findstr "appServer.exe"
if %ERRORLEVEL% == 1 Echo No server Process found
if %ERRORLEVEL% == 1 goto start

and of course, now you have to choose:

choice /T 60 /D y /C YABCDEFGHIJKLMNOPQRSTUVWXZ /N >NUL
if %ERRORLEVEL% == 1 goto loop

now we start the exe

start "" "C:\Program Files (x86)\AppVision 4.0\Bin\appServer.exe"

Set the title

title appServer (re)Started at %NowDate% %NowTime% (Press X to exit script before closing appServer.exe)

Pulling it all together:

@echo off
title appServer (re)Launching script started at %time:~0,2%_%time:~3,2%_%time:~6,2% (Press X to exit script before closing appServer.exe)
pushd "C:\Program Files (x86)\AppVision 4.0\Bin"

:loop
timeout 2 >NUL
rem ping 127.0.0.1 -n 2 >NUL
echo.
tasklist /FI "IMAGENAME eq appServer.exe" | findstr "appServer.exe"
if %ERRORLEVEL% == 1 Echo No server Process found
if %ERRORLEVEL% == 1 goto start
echo Server process found at %time%, waiting 60 seconds
echo.
rem timeout 60
rem ping 127.0.0.1 -n 30 >NUL
choice /T 60 /D y /C YABCDEFGHIJKLMNOPQRSTUVWXZ /N >NUL
rem echo %ERRORLEVEL%
if %ERRORLEVEL% == 1 goto loop
goto eof

:start
set NowTime=%time:~0,2%_%time:~3,2%_%time:~6,2%
set NowDate=%date:~10,4%_%date:~4,2%_%date:~7,2%

cls
echo starting
start "" "C:\Program Files (x86)\AppVision 4.0\Bin\appServer.exe"
title appServer (re)Started at %NowDate% %NowTime% (Press X to exit script before closing appServer.exe)
choice /T 10 /D y /C YABCDEFGHIJKLMNOPQRSTUVWXZ /N >NUL
rem ping 127.0.0.1 -n 11 >NUL
goto loop

:eof
popd
echo script finished due to keypress
rem pause

ASTARO – Adding Win 2k3 as a Authentication server

This article was originally found at “https://support.astaro.com/support/index.php/RADIUS“. We have updated it, because the original was a little light on information, and is considered outdated now.

This was created in a hope that others can get more information, and not have to spend as much time as me, tracking down issues and piecing everything together (not being an expert on RADIUS Authentication)

Step 1 – Add a usergroup to Authenticate against

  • Open Computer Management (Start/All Programs/Administrative Tools/Computer Management),
  • Add a new Usergroup and give it a descriptive and helpful name (I suggest something like “Gateway Users”).

Step 2 – Add users to your group

  • Within Computer Management (System Tools/Local Users and Groups/Users), create users (if necessary)
  • Right click on a user and select Properties
  • Under the Member Of tab, add the group that you created in Step 1 (eg “Gateway Users”)
  • Do Not close Properties dialog box, go to step 3.

Step 3 – Configure Dial-in access

  • Within Properties dialog box, click on the Dial-in tab.
  • choose “Allow Access” under Remote Access Permission (Dial-in or VPN)
  • Save and close the Properties dialog box.

Step 4 – Alter Group Policy for password encryption

  • Within Active Directory Users and Computers, right click on your domain name and chose properties
  • Within the Domain Properties dialog box click Group Management tab
  • Highlight the Default Domain Policy and select “edit”
  • In the GPO Editor, navigate to Computer Configuration/Windows Settings/Security Settings/Account Policies/Password Policy
  • Make sure Store passwords using reversible encryption is enabled
  • Save and close all dialog boxes

Step 5 – Add a client to the IAS RADIUS server

  • Open IAS (Start/All Programs/Administrative Tools/Internet Authentication Server)
  • Right click on RADIUS Clients then chose New RADIUS Client
  • Gave the Client a friendly name of ASG and an IP address
  • Chose RADIUS Standard Vendor-Client and inputted my shared secret (note: will need to input this on the ASG, so write it down)

Step 6 – Create a new Remote Access Policy

  • Within IAS, right click on Remote Access Policies and Choose New Remote Access Policy
  • In the wizard, Choose Set Up Custom Policy and give the policy a descriptive name
  • Select the NAS-Identifier policy condition and give the NAS ID of pptp (lowercase)
  • Select the Windows-Groups policy condition as well and add the group specified in Step 1
  • Choose Grant Remote Access
  • Edit the profile to include CHAP on the Authentication tab (You can include PAP as well, but this is an insecure method)
  • Save and close all configurations on the Active Directory server

Step 7 – Configure the ASG

  • Navigate to Definitions & Users/Authentication Servers/Servers
  • Add the server, service port (keep default unless absolutely certain) and shared secret from Step 5
  • Save the configuration

You are now done with the configuration. In a few minutes, at most, you should be able to use the RADIUS server to authenticate to ASG facilities. If there is an issue where authentication continually fails, most likely there is a setting on the AD server that needs to be adjusted.

Advanced Settings

If you wanted to get fancy, you could do the following:

Setup a Group for each part of the ASTARO Secure Gateway components (such as Proxy, VPN, Webadmin, etc)

Setup a Remote Access Policy which mimicks the above, while adding “NAS-Identifier” as an extra step. ASTARO sends a unique identifier for each part, so you can setup groups within windows to authorise access to whatever you want, and then you no longer need to edit users at the ASG Web Admin.

This requires setting up “Automatic User Creation” (Definitions & Users/Authentication Servers/Global Settings).

Troubleshooting

Use the Test feature of the Edit Authentication Server Page to check if the user is getting authorisation.

Use the Event viewer on the server to check the “System” Logs, Failed Logon events will show further details here (as long as ASG is setup with the correct server details.

http://technet.microsoft.com/en-us/library/cc782585.aspx is a good place to start for troubleshooting various items on the windows side.

Opening ISO CD/DVD image files

We often get asked how to get information from an .ISO .bin or other type of CD / DVD image file, so here are the easiest ways we know of.

  1. Mount the ISO as though it was burnt to a CD/DVD and inserted into a drive on your PC
  2. Extract all files from the image to a directory on your PC

Mount the CD/DVD Image

Download and install Virtual CloneDrive from slysoft, double click on your file and start browsing.

Extract the files

Download and install Universal extractor, then right mouse click on the file and choose extract, select a location, and kick back and relax for a minute or two while the magic happens.

How Compact Disks are Made

Have you ever wondered how all those CDs & DVDs are made ?

this discovery channel video shows you exactly how its done (its a bit old now, but i’m sure the process is still similar).

RJ45 Cat 5 cable pin-outs

Ethernet RJ45 Socket 10baseT Colour Code
Pin No Description Colour
1_____TX +_______Orange/White
2_____TX -_______Orange
3_____RX +_______Green/White
4________________Blue
5________________Blue/White
6_____RX -_______Green
7________________Brown/White
8________________Brown
_________________________________

RJ45 Cross Over Cable 10baseT
RJ45 Male RJ45 Male
1__________3
2__________6
3__________1
6__________2
______________________________________

RJ45 100base-T4 Crossover male to male
Name______Pin__Pin__Name
TX_D1+____1____3____RX_D2+
TX_D1-____2____6____RX_D2-
RX_D2+____3____1____TX_D1+
RX_D2-____6____2____TX_D1-
BI_D3+____4____7____BI_D4+
BI_D3-____5____8____BI_D4-
BI_D4+____7____4____BI_D3+
BI_D4-____8____5____BI_D3

It’s important that each pair is kept as a pair. TX+ & TX- must be in
the pair, and RX+ & RX- must together in another pair etc. (Just as
the table above shows).

HTML 4.0 Symbols

Many People still use editors that either don’t have or have limited access to symbols, but still need to put them into HTML from time to time (like myself).

Below is a small table of some Symbols, their HEX and Decimal Values.
The Complete original table is found HERE on htmlhelp.com … give credit where its due.

Character Entity Decimal Hex Rendering in Your Browser
Entity Decimal Hex
Latin small f with hook = function = florin ƒ ƒ ƒ ƒ ƒ ƒ
Greek capital letter alpha Α Α Α Α Α Α
Greek capital letter beta Β Β Β Β Β Β
Greek capital letter gamma Γ Γ Γ Γ Γ Γ
Greek capital letter delta Δ Δ Δ Δ Δ Δ
Greek capital letter epsilon Ε Ε Ε Ε Ε Ε
Greek capital letter zeta Ζ Ζ Ζ Ζ Ζ Ζ
Greek capital letter eta Η Η Η Η Η Η
Greek capital letter theta Θ Θ Θ Θ Θ Θ
Greek capital letter iota Ι Ι Ι Ι Ι Ι
Greek capital letter kappa Κ Κ Κ Κ Κ Κ
Greek capital letter lambda Λ Λ Λ Λ Λ Λ
Greek capital letter mu Μ Μ Μ Μ Μ Μ
Greek capital letter nu Ν Ν Ν Ν Ν Ν
Greek capital letter xi Ξ Ξ Ξ Ξ Ξ Ξ
Greek capital letter omicron Ο Ο Ο Ο Ο Ο
Greek capital letter pi Π Π Π Π Π Π
Greek capital letter rho Ρ Ρ Ρ Ρ Ρ Ρ
Greek capital letter sigma Σ Σ Σ Σ Σ Σ
Greek capital letter tau Τ Τ Τ Τ Τ Τ
Greek capital letter upsilon Υ Υ Υ Υ Υ Υ
Greek capital letter phi Φ Φ Φ Φ Φ Φ
Greek capital letter chi Χ Χ Χ Χ Χ Χ
Greek capital letter psi Ψ Ψ Ψ Ψ Ψ Ψ
Greek capital letter omega Ω Ω Ω Ω Ω Ω
Greek small letter alpha α α α α α α
Greek small letter beta β β β β β β
Greek small letter gamma γ γ γ γ γ γ
Greek small letter delta δ δ δ δ δ δ
Greek small letter epsilon ε ε ε ε ε ε
Greek small letter zeta ζ ζ ζ ζ ζ ζ
Greek small letter eta η η η η η η
Greek small letter theta θ θ θ θ θ θ
Greek small letter iota ι ι ι ι ι ι
Greek small letter kappa κ κ κ κ κ κ
Greek small letter lambda λ λ λ λ λ λ
Greek small letter mu μ μ μ μ μ μ
Greek small letter nu ν ν ν ν ν ν
Greek small letter xi ξ ξ ξ ξ ξ ξ
Greek small letter omicron ο ο ο ο ο ο
Greek small letter pi π π π π π π
Greek small letter rho ρ ρ ρ ρ ρ ρ
Greek small letter final sigma ς ς ς ς ς ς
Greek small letter sigma σ σ σ σ σ σ
Greek small letter tau τ τ τ τ τ τ
Greek small letter upsilon υ υ υ υ υ υ
Greek small letter phi φ φ φ φ φ φ
Greek small letter chi χ χ χ χ χ χ
Greek small letter psi ψ ψ ψ ψ ψ ψ
Greek small letter omega ω ω ω ω ω ω
Greek small letter theta symbol ϑ ϑ ϑ ϑ ϑ ϑ
Greek upsilon with hook symbol ϒ ϒ ϒ ϒ ϒ ϒ
Greek pi symbol ϖ ϖ ϖ ϖ ϖ ϖ
bullet = black small circle • • •
horizontal ellipsis = three dot leader … … …
prime = minutes = feet ′ ′ ′
double prime = seconds = inches ″ ″ ″
overline = spacing overscore ‾ ‾ ‾
fraction slash ⁄ ⁄ ⁄
script capital P = power set = Weierstrass p ℘ ℘ ℘
blackletter capital I = imaginary part ℑ ℑ ℑ
blackletter capital R = real part symbol ℜ ℜ ℜ
trade mark sign ™ ™ ™
alef symbol = first transfinite cardinal ℵ ℵ ℵ
leftwards arrow ← ← ←
upwards arrow ↑ ↑ ↑
rightwards arrow → → →
downwards arrow ↓ ↓ ↓
left right arrow ↔ ↔ ↔
downwards arrow with corner leftwards = carriage return ↵ ↵ ↵
leftwards double arrow ⇐ ⇐ ⇐
upwards double arrow ⇑ ⇑ ⇑
rightwards double arrow ⇒ ⇒ ⇒
downwards double arrow ⇓ ⇓ ⇓
left right double arrow ⇔ ⇔ ⇔
for all ∀ ∀ ∀
partial differential ∂ ∂ ∂
there exists ∃ ∃ ∃
empty set = null set = diameter ∅ ∅ ∅
nabla = backward difference ∇ ∇ ∇
element of ∈ ∈ ∈
not an element of ∉ ∉ ∉
contains as member ∋ ∋ ∋
n-ary product = product sign ∏ ∏ ∏
n-ary sumation ∑ ∑ ∑
minus sign − − −
asterisk operator ∗ ∗ ∗
square root = radical sign √ √ √
proportional to ∝ ∝ ∝
infinity ∞ ∞ ∞
angle ∠ ∠ ∠
logical and = wedge ∧ ∧ ∧
logical or = vee ∨ ∨ ∨
intersection = cap ∩ ∩ ∩
union = cup ∪ ∪ ∪
integral ∫ ∫ ∫
therefore ∴ ∴ ∴
tilde operator = varies with = similar to ∼ ∼ ∼
approximately equal to ≅ ≅ ≅
almost equal to = asymptotic to ≈ ≈ ≈
not equal to ≠ ≠ ≠
identical to ≡ ≡ ≡
less-than or equal to ≤ ≤ ≤
greater-than or equal to ≥ ≥ ≥
subset of ⊂ ⊂ ⊂
superset of ⊃ ⊃ ⊃
not a subset of ⊄ ⊄ ⊄
subset of or equal to ⊆ ⊆ ⊆
superset of or equal to ⊇ ⊇ ⊇
circled plus = direct sum ⊕ ⊕ ⊕
circled times = vector product ⊗ ⊗ ⊗
up tack = orthogonal to = perpendicular ⊥ ⊥ ⊥
dot operator ⋅ ⋅ ⋅
left ceiling = APL upstile ⌈ ⌈ ⌈
right ceiling ⌉ ⌉ ⌉
left floor = APL downstile ⌊ ⌊ ⌊
right floor ⌋ ⌋ ⌋
left-pointing angle bracket = bra ⟨ 〈 〈
right-pointing angle bracket = ket ⟩ 〉 〉
lozenge ◊ ◊ ◊
black spade suit ♠ ♠ ♠
black club suit = shamrock ♣ ♣ ♣
black heart suit = valentine ♥ ♥ ♥
black diamond suit ♦ ♦ ♦