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

Icons for webpages using Font-Awesome

At SecureTech, our staff have been creating websites since the early days of the web. When we first started building webpages (20+ years ago), it was rather difficult to put icons on webpages, as each icon required the developer (no such thing as web designers back then … ) to create it as an image and upload it into the site, before creating an <img> tag to insert it into the code. now, we can have icons for webpages using Font-Awesome, which is awesome (it had to be said…).

Font-Awesome allow the web-designer or developer to quickly insert some unicode to insert an icon, or use CSS to insert it wherever required after the development is done (provided the developer allowed for this by labelling each section of the HTML appropriately.

We needed a list of available icons in Font-Awesome and decided to create a list of the Font-Awesome icons on our website, to make it easier for others to use (but its mostly for us)

IPChanger for Windows IPV4 settings

The IPChanger for Windows 10, allows you to change your IP address details with just two clicks, disconnect/reconnect adapters .

WARNING
This program is designed to be used by personnel who administrate Network’s and/or have a good understanding of the Network addressing scheme’s of their networks.
Using this program incorrectly may stop your computer from accessing or being accessible on the network, and you may loose internet connection.

Download

Download IPChangerV3.8

Screenshots

Welcome Screen for IPChanger (V3.8)
Main Screen for IPChanger (V3.8)

History

Originally created by Timmio (Circa 2009), the application was updated by us to deal with Windows 7 changes and then again for Windows 10, Unfortunately the original location of the software has been lost to us, so we cannot link to it. If you find it, please comment below, so we can give credit where its due.

Backup MYSQL databases on Windows 10 free Script

We needed a simple way to automatically Backup MySQL on windows 10 for free. Our development and testing environments required:

  • The convenience of backing up all DBs (such as This Script does).
  • Ability to exclude some of the DBs in each machine.
  • Date stamped backups, so changes are backed up each day.
  • Free and preferably open-source.
  • Easy to integrate into our existing backup scripts.

A quick search showed up nothing. We decided to expand the above mentioned script functionality to include what we require. Provided below is the important parts of the script:

:: allows for skipping of particular databases
set SkipThis=0
for /d %%f in (*) do (
    set /A Counterf=!Counterf!+1
    :: remove echo here if you like
    echo processing folder "%%f"
    pushd "%~dp0"
        set Countera=0
        for %%a in (*.exclude) do (
            rem increment the counter, so we know how many files we have read.
            set /A Countera=!Countera!+1
            if %Debug% == 1 echo DEBUG - Exclude file found: "%%~na"
            if %%a == %%f.exclude set SkipThis=1
            if !SkipThis! == 1 if %Debug% == 1 echo DEBUG - Skipping Backup of "%%f"
            )
        If %Debug% == 1 echo DEBUG - !Countera! exclude files checked
    popd

    if !SkipThis! == 0 %mysqldump% --host="localhost" --user=%dbUser% --password=%dbPassword% --single-transaction --add-drop-table --databases %%f > %backupDir%\%dirName%\%%f.sql
    if !SkipThis! == 0 %zip% a -tzip %backupDir%\%dirName%\%fileSuffix%_%%f.sql.zip %backupDir%\%dirName%\%%f.sql
    if !SkipThis! == 0 set /A Counterb=!Counterb!+1

    :: make sure to set this back to normal, so we don't skip the next DB backup as well
    set SkipThis=0
)
echo DONE - !Counterf! DBs found, !Counterb! DBs backed up

We then just need to create some blank files with “.exclude” extension. The “.exclude” files have the same name as the DB to exclude. Example such as “sys.exclude” will exclude the “sys” DB from backups

Licensing is as usual, this script is Open Source and we provide a download for your easy of use.

Troubleshooting

  1. If backups are not created, check all your location variables are set correctly

How to Use

  1. Download the MySQL Backup Script and extract into a suitable location.
  2. Open up “MySQLBackup.bat” in notepad++ (or similar).
  3. You will need to change the dbUser, dbPassword, backupDir, mysqldump, mysqlDataDir and zip file/app locations on lines 4-9.
  4. Save the file and run (you can open a command prompt by typing cmd into the title bar of explorer)
  5. This script will now be executable. Go to your command prompt and run this to backup your databases.
  6. If backups are not created, check all your location variables are set correctly

Next time you need to Backup MySQL on windows 10 for free, use this script to make it easy

Contact Us

Sutherland
Sydney
NSW
2232
Australia
(+61) 02 9043 5030
(+61) 0411 275 633
http://yts.com.au
Your Tech is Our Business

Your Name (required)

[text* your-name]

Your Email (required)

[email* your-email]

Subject

[text your-subject]

Your Message

[textarea your-message]

[submit “Send”]

Flonix IT Solutions

Flonix IT Solutions offers flexible IT support, professional IT project delivery and expert IT advice. Our Head Office is based in Perth but with offices in Edinburgh, Manchester & London we service most areas within the UK.   We can support any size of company. We excel in delivering a fast, reliable and accountable service to our clients. We take a flexible approach to IT which is determined by our clients business needs. We can operate as the client’s IT department, or add to an existing IT resource within the company. Our people are highly-trained, professionals who have the expertise to assess, repair and maintain any PC, Server, network or Apple Macintosh system.

JWR Constructions

JWR Constructions specialises in arcitectural glass and aluminium products, such as doors, bi-fold doors, windows, shop fronts, Balustrades, pool fences, shower screens, splash backs and much more. Based in Kirrawee (Sydney), they have clients all over the country.

Security & Encryption

TrueCrypt
TrueCrypt is a software system for establishing and maintaining an on-the-fly-encrypted volume (data storage device). On-the-fly encryption means that data is automatically encrypted right before it is saved and decrypted right after it is loaded, without any user intervention. No data stored on an encrypted volume can be read (decrypted) without using the correct password/keyfile(s) or correct encryption keys. Entire file system is encrypted (e.g., file names, folder names, contents of every file, free space, meta data, etc).

Microsoft Security Essentials
Use Microsoft Security Essentials to guard against viruses, spyware, and other evil software. It provides real-time protection for your home or small business PCs.

Microsoft Security Essentials is free and is designed to be simple to install and easy to use. It runs quietly and efficiently in the background so you don’t have to worry about interruptions or making updates.

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.