Showing posts with label utility. Show all posts
Showing posts with label utility. Show all posts

Wednesday, December 18, 2013

iTop running on Windows portable PHP/MySQL MoWeS

Based on my previous topic informing about the nice functionalities of MoWeS to get easily and quickly a PHP/MySQL environment, I did set up an iTop environment in order to discover and play with the CMDB/ITIL ticketing service desk tool.

While doing so, I also discovered the MoWeS Mixer is not available any longer. Apparently the company Chsoftware behind this tools has stopped in 2012. But the MoWeS tool still works very well on Windows 7 x64 and new packages can easily be added by updating the mowes.ini and packages.ini files manually.

In order to get iTop running, some other parameters had to be updated as well: extra memory allocation is to be allowed in php.ini by changing the memory_limit from 32M to 64M. The php_soap.dll extension needs to be loaded as well by uncommenting it in the php.ini file. For mysql, the allowed packets needed to be extended by adding a parameter max_allowed_packet=500M within the [mysqld] section of the my.ini file.

I’ve created an archive containing a clean MoWeS environment with clean iTop. The iTop still needs to be configured using the web wizard upon first connection to the iTop site (localhost/itop) (mysql username: root, password: <empty>. I’ve also a MoWeS environment with base demo iTop installed (itop username: admin, password: itop).

Thursday, August 8, 2013

Svn file full history

If you’d need to search in the full history of a file stored in SVN, the script below can make an export of all changes ever applied into a file, starting for the first revision (full file) and adding each time an overview of all changes applied.

If you remember you ever applied some changes in a file, but removed it afterwards, this can help to search in the full history. Only tested on text based files.

For each revision, the revision number, author, timestamp and svn comments will be listed, followed by an overview of the removed lines, added lines, update lines etc. The initial revision will be a full extract of the original file.

Usage: save the SvnFileFullHistory.bat script in an SVN folder next to the file for which you’d need a full history extract. Drop the svn file onto the bat script to start the script and retrieve the full history of the dropped svn file. The full svn file history will be saved in a txt file in the same folder and with the same base name as the file to extract, but adding “-FullSvnHistory.txt” behind the file name. The extract can take a while, depending on the number of revisions and the size of the svn file. But while the extract is ongoing, the “…-FullSvnHistory.txt” can be read already, reloading it to get future updates.

A similar linux shell script has been created as well (not fully tested).

Based on information found on stackoverflow by user ladenedge.

Full script content:

@echo off   
TITLE SVN - Full file history
REM Original source: http://stackoverflow.com/questions/282802/how-can-i-view-all-historical-changes-to-a-file-in-svn and http://stackoverflow.com/questions/5622367/generate-history-of-changes-on-a-file-in-svn/5721533#5721533
echo Copy this bat script next to the checked out svn file on which to get full svn history. Drag and drop the svn file onto the bat script to start fetching the info (or a open command window and provide the name of the svn file as first parameter to the bat script execution)
if "%1%"=="" pause
set file=%1
set report=%file%-FullSvnHistory.txt
if [%file%] == [] (
  echo Usage: "%0 <file>"
  exit /b
)
echo Retrieving svn history of file, please wait...
echo The report will be saved in the file: %report%.
echo To stop the process press Ctrl+c.
rem first revision as full text
for /F "tokens=1 delims=-r " %%R in ('"svn log -q %file%"') do (
  svn log -r %%R %file% > %report%
  svn cat -r %%R %file% >> %report%
  goto :diffs
)
:diffs
rem remaining revisions as differences to previous revision
for /F "skip=2 tokens=1 delims=-r " %%R in ('"svn log -q %file%"') do (
  echo.
  svn log -r %%R %file% >> %report%
  svn diff -c %%R %file% >> %report%
)

Friday, January 21, 2011

Salling Clicker - Windows Mobile

Salling Clicker is a remote control software. It lets you control popular applications from a mobile phone or handheld computer through a user interface similar to a portable media player.
You can choose to have the computer take action when you make or receive a phone call or get close to your pc. For instance, Salling Clicker can automatically mute the system volume while you're on the phone or automatically lock the pc while your gone.

  • Control PowerPoint, iTunes, Windows Media Player, and more with your mobile device.
  • Works with all major Bluetooth stacks (no configuration required).
  • Amazingly easy-to-use WiFi connectivity for long-range control.
  • Works with over 300 devices.
  • Easily extend support for other applications using JavaScript or VBScript

Scripts

Salling Clicker is installed with a set of default scripts (JavaScript for Windows) to support many different applications (PowerPoint, iTunes, MediaPlayer, etc.). On the forums of Salling Clicker many other custom scripts can be found, created and shared by the community.
I've created a set of personal scripts, some are base on the official scripts, some are based on the scripts found in the forums and some are completely new. I just list all the scripts I use:
  • De Slimste Mens: as explain in this separate blog post, I've created a complete interface to control the Flemish game "De Slimste Mens".
  • myT Mouse Keyboard: full control for mouse and keyboard. Specially made for Windows Mobile devices with hardware keyboard (tested on Samsung Omnia B7310 and HTC Wizard (Qtek9100)). Use the screen to move mouse, use 'Menu' button to get context menu (mouse right click), use 'Help' button for extra options. To get a good overview of all options, I’ve put some screenshot online.
    Use hardware keyboard to send all keys. The used keys will be displayed on the main screen for easy action tracking.
    The extra option are:
    • switching of Shift/Ctrl/Alt/Win keys
    • sending special characters
    • sending function keys (eg F1-F12, pause, insert, delete, etc)
    • sending media keys (play next song, webbrowser control, etc)
    • sending long text: text input on device
    • open a file on pc: navigate to folder and open a file, recent file history, easy access to favorite locations (eg start menu, 'my documents', etc)
    • Zoom screen using freeware ZoomIt application, all ZoomIt options supported (pen, break, etc)
    • Show a screenshot of the pc on the main screen.
    • Exchange data from pc clipboard to device and/or put text into the pc clipboard
  • PowerPoint: distribuated by Salling Clicker
  • MediaPlayer: distribuated by Salling Clicker
  • MediaPortal: from forum
  • MediaCenter: from forum
  • iTunes: distribuated by Salling Clicker
  • BSPlayer: from forum
  • VLC: from forum
  • WinDVD: from forum
  • MSN Online status: from forum
  • uTorrent: from forum
  • ShutdownControls: shutodown/hibernate/standby/screen on-off/lock
  • Device Info: distiribuated by Salling Clicker
  • Disconnect: distiribuated by Salling Clicker
  • System volume: control pc volume
  • MuteWhileOnPhone: distribuated by Salling Clicker
  • CallNotifier: distribuated by Salling Clicker
  • LockComputer: distribuated by Salling Clicker
  • MonitorAway: distribuated by Salling Clicker
  • Show Message: show message on pc

Wednesday, November 24, 2010

MoWes Portable + OS Commerce 2.2 / 3.0a

I wanted to play with OS Commerce. Since this is written in PHP I needed some portable PHP, Apache and MySQL package. MoWes Portable does exactly what I was looking for and they offer some very nice online MoWes Mixer so anyone can easily create it’s own portable package (choice in version, packages, etc.). I created my own package with OSCommerce v2.2, v3.0a and phpMyAdmin. I added extra languages and applied some standard configuration/tweaks to make it immediately usable in Belgium.

Full package download containing MoWes Portable 2, Apache2_SE, MySQL5_SE, PHP52, MediaWiki, OpenDB, OS_Commerce 2.2, OS_Commerce 3.0a, phpBB3 and PHPMyAdmin.

VirtueMartVirtueMart is a similar open source project, but build within Joomla!. For me they seem very similar in the provided functionality. Joomla and thus VirtueMart can be integrated within MoWes as well using the MoWes mixer.

Monday, November 16, 2009

Recovery tools boot USB stick


Based on Hiren's Boot CD 12 I created my personal Boot USB stick to be as complete as possible (containing more than 500 portable tools, 2,30GB). The original Hiren recovery CD contains many very useful tools to recover, tweak or patch pc's, divided into the following categories: Partition Tools, Backup Tools, Recovery Tools, Testing tools, RAM testing tools, Hard disk tools, System information tools, Master Boot Recovery tools, BIOS CMOS tools, Multimedia tools, Password tools, NTFS tools, Browser File manager tools, Other tools, Dos tools, Optimizers, Network tools, Process tools, Registry tools, Startup tools, Tweakers and Antivirus tools. A portable 'mini Windows XP' that can be run from the stick is available as well at boot time.


Many of the tools are available by booting up from the USB stick, but others need to be run into a Windows environment. These windows tools can be easily accessed by using the 'HBCDMenu.exe' tool which will be started when the cd or USB stick is started within a running Windows environment. Since the tools available within the 'HBCDMenu.exe' can be configured very easily using a 'HBCDMenu.csv' file, I created an Excel file to change the configuration an export to the csv file easier. Using this Excel it is much easier to move and rearrange the tools. Next I added all the tools I was still missing to make them available through the 'HBCDMenu.exe' tool. All tools are started using a DOS bat script and an UHARC archive. The archive is extracted in the PC's %temp% folder and started. All tools should be completely portable so no tool settings in the registry are kept after running them. I created a generic batch script to be able to run all tools in different modes: normal, just open a command window, just open an explorer windows, run the tool in Sandboxie, show online info on the tool, convert the tool into a zip file, force extraction of the uharc file. The mode is set by creating a specific file in the %temp% folder.


I keep all my personal files in a secured FreeOTFE file to make sure if I ever lose the stick no personal information can be discovered.


Besides the Hiren tools I also converted the latest BackTrack 4 bootable ISO to make it boot from a USB stick and added this into the Hiren boot screen menu. This live cd linux distribution is focused on penetration testing and perfect for quick and easy WEP cracking.


On the website of Hiren, a good explanation is provided by Hiren on how to easily convert the BootCD into a bootable USB stick using Grub4Dos. I used this 'menu.lst' as boot menu so it includes the launch of the BackTrack live environment and portable Mini Windows XP. Within an Windows environment, this 'autorun.inf' file is used to make it easier to start the 'autorun.exe' tool and other commonly used tools. To keep a backup of all my configuration, I configured a specific portable Dropbox so I can access all my tools online and keep them in sync on different locations.


The USB stick with all the extra tools requires now at least 2,29GB (I use it on a 8GB stick). I also added many of my extra tools into the CD iso file, but to keep it burnable onto a 80minute CD, some of the large tools didn't fit (office portable, tor browser, skype, toad, oracle client).


Compared to the original Hiren 10 boot cd, I've added different Windows tools. In the HBCDMenu cvs creator Excel, the complete list of all the tools are ordered in comprehensive categories. Many of these tools come from Sysinternals and Nirsoft since they provide some very useful portable little tools.


Update 25/11/2009: removed long list of personally added tools
Update 3/12/2010: update for Hiren Boot CD 12

Wednesday, September 16, 2009

Mouse rocker gestures

Mouse Rocker
Based on the AutoHotKey script from Adam Pash on the Lifehacker site, I made my own version to fit my personal mouse rocker gesture needs.

Basically, a mouse rocker gesture requires that you press one mouse button, hold it down, then press the other. You can rock across the mouse from right-to-left or left-to-right; each direction you rock gives you a different result. Once you get used to this gesture, the name makes perfect sense, and you'll wonder why you weren't mouse rocking your whole life.


I changed the way the script is configured so one can now easily add process names in the rocker.ini file to change the behaviour for a specific application. And I added extra navigation combinations so one should be able to easily make it fit his own needs.
For example in excel you can now easily switch to the next or previous tabbed sheet using mouse rocker gestures. UltraEdit switching between open files is also supported by sending 'Alt + up' or 'Alt + down' keys with the mouse rocker gestures. On first run, it will now also ask if you want to start the tool automatically during windows start. The ini file is created on first run in the directory from where the rocker.exe file is launched. The different groups denote the keys that will be send when a mouse rocker gesture is detected, one can easily add or remove any process name to change the behaviour in a specific application.
[Preferences]
CtrlGroup=itunes.exe
CtrlTabGroup=notepad++.exe,dreamweaver.exe,pidgin.exe
CtrlUpDnGroup=empty
CtrlPgUpDnGroup=excel.exe
AltGroup=firefox.exe,iexplore.exe,opera.exe,feeddemon.exe,explorer.exe
AltUpDnGroup=uedit32.exe
AltPgUpDnGroup=empty
BckspGroup=empty
IgnoreGroup=empty
Startup=1
UpdateCheck=0
Version=0.3



No installation is required, just download the zip file, extract and run the exe. The AutoHotKey source script is included in the zip file.

Update 19/02/2011: links updated

Update 20/12/2017: links updated

Monday, May 11, 2009

LogExpert - Windows tail freeware

Today I tested yet another Windows tail application, LogExpert, and I was very amazed with its features!
It has most of the features I'm used to work with in BareTail Pro, like adding some filters (regex) or highlighting lines matching some text. And unlike WinLogTail, it does support opening multiple files at one with a tabbed interface as in BareTail.
Besides all this, I really appreciate the following functions:
  • run some specified application and providing some information of the selected line. This way, one can easily open the tailed file within UltraEdit on the selected line.
  • parse the timestamps of a log file and show these in separated columns
  • freeze some columns to make these alway be shown and only scrolling other columns (horizontal scrolling)
  • advanced filtering with possibility to show some lines before or after the line matching your filter
  • activate an 'edit' mode to easily copy some parts of a line
  • add some bookmarks and comments on a line to easily find these back afterwards
  • support for multifiles (show files as app.log, app.log1, app.log2, etc as one big file)
  • support for different files provided on the command line while opening, so the scripts we used to open many files with BareTail also work with LogExpert (but opening many files from shared drives is not as lighting fast as with BareTail)

So, compared to BareTail it has many benefits and it's completely free! But one should know, it's not always as fast and stable as BareTail, but so far it worked very well for me.

Some nice screenshots (but those only show a small subset of all it's features):

Sunday, April 12, 2009

Run custom application or script as a Windows service

If you need your application or script to be started, whenever Windows is booted, you need to install it as a service (so  it will even be started when you didn’t login yet). Microsoft offers a little tool to easily create your own service and make it run some batch file / application as a part of their Windows Server Resource Kit Tools. From this package, you only need srvany.exe and instsrv.exe to install your custom service, but you still need to perform all this manual configuration before your service will be running.

I created the following batch script to easily install or uninstall your custom application as a service. All required information will be requested interactively to the user step by step. No further manual configuration will be needed anymore. Errors will be shown with colors and attention points will be flashed.

@echo off
echo.
echo.
echo Use this script to install / uninstall your custom applications or scripts as a service and make sure they will be started whenever Windows is booted.
SET DFAULT_BACKGROUND_COLOR=0
SET DEFAULT_TEXT_COLOR=7
SET ERROR_BACKGROUND_COLOR=4
SET ERROR_TEXT_COLOR=F
SET ATTENTION_BACKGROUND_COLOR=0
SET ATTENTION_TEXT_COLOR=F
rem 0 = Black
rem 1 = Blue
rem 2 = Green
rem 3 = Aqua
rem 4 = Red
rem 5 = Purple
rem 6 = Yellow
rem 7 = White
rem 8 = Gray
rem 9 = Light Blue
rem A = Light Green
rem B = Light Aqua
rem C = Light Red
rem D = Light Purple
rem E = Light Yellow
rem F = Bright White
:MAIN_MENU
  COLOR %DFAULT_BACKGROUND_COLOR%%DEFAULT_TEXT_COLOR%
  
  SET RETURN_DRAW_ATTENTION_POINT=MAIN_MENU_INPUT
  GOTO DRAW_ATTENTION
  :MAIN_MENU_INPUT
    echo.
    echo.
    SET INPUT=
    echo To Install a new custom service, press I.
    echo To Uninstall a previously created custom service, press U.
    echo To open the Windows Services application, press S.
    set /p INPUT=Press E to Exit: 
    if /i "%INPUT%" == "i" goto START_INSTALL
    if /i "%INPUT%" == "u" goto START_UNINSTALL
    if /i "%INPUT%" == "s" goto START_SERVICES
    if /i "%INPUT%" == "e" goto EXIT
    GOTO MAIN_MENU
  :END_MAIN_MENU_INPUT
  echo.     
:END_MAIN_MENU
  
:START_INSTALL
  rem INTERACTIVE MODE is used, lines below kept for reference
  :HARD_CODED_PATHS_AND_NAMES
  rem APP_NAME=REPLACE_THIS_WITH_YOUR_CUSTOM_APP_NAME
  rem APP_PATH=FULL_PATH_TO_CUSTOM_APP
  rem one can use %CD% in the path, which will be replace by the current directory
  rem uncomment following 2 lines if you want to use the folder name (where this bat file is run) as service name APP_NAME
  rem SET APP_NAME=
  rem for %%* in (.) do set APP_NAME=%%~n*
  
  :INTERACTIVE_INPUT_OF_PATHS_AND_NAMES
    :INTERACTIVE_INPUT_APP_NAME
      echo.
      SET APP_NAME=
      set /p APP_NAME=Provide the name of your custom application (will be used as the name of the service): 
      echo. 
    :END_INTERACTIVE_INPUT_APP_NAME
    
    :INTERACTIVE_INPUT_OF_APP_PATH
      echo. 
      SET APP_PATH=
      set /p APP_PATH=Provide the full path of your custom application to run as a service (don't use quotes): 
      echo. 
    :END_INTERACTIVE_INPUT_OF_APP_PATH
    
    :CHECK_CUSTOM_APP_PATH
      IF EXIST "%APP_PATH%" GOTO END_CHECK_CUSTOM_APP_PATH
      echo.
      echo Your custom application %APP_NAME% could not be found at %APP_PATH%!
      echo Please try again!
      SET RETURN_DRAW_ERROR_ATTENTION_POINT=INTERACTIVE_INPUT_OF_APP_PATH
      GOTO DRAW_ERROR_ATTENTION
    :END_CHECK_CUSTOM_APP_PATH
      COLOR %DFAULT_BACKGROUND_COLOR%%DEFAULT_TEXT_COLOR%
      
    :INTERACTIVE_INPUT_APP_FOLDER
      echo.
      SET APP_FOLDER=
      set /p APP_FOLDER=Provide the folder to be used as working directory for your custom application (press ENTER if not required) (don't use quotes): 
      echo. 
    :END_INTERACTIVE_INPUT_APP_PARAM
      
    :INTERACTIVE_INPUT_APP_PARAM
      echo.
      SET APP_PARAM=
      set /p APP_PARAM=Provide the parameters of your custom application (press ENTER if no parameters are required) (don't use quotes): 
      echo. 
    :END_INTERACTIVE_INPUT_APP_PARAM
    
    :INTERACTIVE_INPUT_OF_INST_SERVICE_APP_PATH
      echo. 
      SET INST_SERVICE_APP_PATH=
      set /p INST_SERVICE_APP_PATH=Provide the full path to instsrv.exe (don't use quotes). LEAVE EMPTY to use default path (%CD%\instsrv.exe): 
    :END_INTERACTIVE_INPUT_OF_INST_SERVICE_APP_PATH
    
    :CHECK_INST_SERVICE_APP_PATH_INPUT
      if "%INST_SERVICE_APP_PATH%"=="" goto DEFAULT_INST_SERVICE_APP_PATH
    :END_CHECK_INST_SERVICE_APP_PATH_INPUT
    
    :CHECK_INST_SERVICE_APP_PATH
      IF EXIST "%INST_SERVICE_APP_PATH%" GOTO END_CHECK_INST_SERVICE_APP_PATH
      echo.
      echo instsrv.exe could not be found at %INST_SERVICE_APP_PATH%!
      echo Please try again!
      SET RETURN_DRAW_ERROR_ATTENTION_POINT=INTERACTIVE_INPUT_OF_INST_SERVICE_APP_PATH
      GOTO DRAW_ERROR_ATTENTION
    :END_CHECK_INST_SERVICE_APP_PATH
      COLOR %DFAULT_BACKGROUND_COLOR%%DEFAULT_TEXT_COLOR%
    
    :INTERACTIVE_INPUT_OF_SERVICE_APP_PATH
      echo. 
      SET SERVICE_APP_PATH=
      set /p SERVICE_APP_PATH=Provide the full path to srvany.exe (don't use quotes). LEAVE EMPTY to use default path (%CD%\srvany.exe): 
    :END_INTERACTIVE_INPUT_OF_SERVICE_APP_PATH
    
    :CHECK_SERVICE_APP_PATH_INPUT
      if "%SERVICE_APP_PATH%"=="" goto DEFAULT_SERVICE_APP_PATH
    :END_CHECK_SERVICE_APP_PATH_INPUT
    
    :CHECK_SERVICE_APP_PATH
      IF EXIST "%SERVICE_APP_PATH%" GOTO END_CHECK_SERVICE_APP_PATH
      echo.
      echo srvany.exe could not be found at %SERVICE_APP_PATH%!
      echo Please try again!
      SET RETURN_DRAW_ERROR_ATTENTION_POINT=INTERACTIVE_INPUT_OF_SERVICE_APP_PATH
      GOTO DRAW_ERROR_ATTENTION
    :END_CHECK_SERVICE_APP_PATH
      COLOR %DFAULT_BACKGROUND_COLOR%%DEFAULT_TEXT_COLOR%
  
  :END_INTERACTIVE_INPUT_OF_PATHS_AND_NAMES  
  
  :SHOW_CONFIG
    echo.
    echo Ready to install your custom application, using the following configuration:
    echo.
    echo   Custom application name: %APP_NAME%
    echo   Custom application full path: %APP_PATH%
    echo   Custom application parameters: %APP_PARAM%
    echo   Custom application working directory: %APP_FOLDER%
    echo   srvany.exe full path: %SERVICE_APP_PATH%
    echo   instsrv.exe full path: %INST_SERVICE_APP_PATH%
    echo.
    SET RETURN_DRAW_ATTENTION_POINT=SHOW_CONFIG_WAIT
    GOTO DRAW_ATTENTION
    :SHOW_CONFIG_WAIT
      COLOR %ATTENTION_BACKGROUND_COLOR%%ATTENTION_TEXT_COLOR%
      set INPUT=
      set /p INPUT=Press ENTER to continue installation, all other will return to main menu: 
      if /i not "%INPUT%" == "" GOTO MAIN_MENU
      COLOR %DEFAULT_BACKGROUND_COLOR%%DEFAULT_TEXT_COLOR%
    :END_SHOW_CONFIG_WAIT
  :END_SHOW_CONFIG
  
  :INSTALL_SERVICE
    "%INST_SERVICE_APP_PATH%" "%APP_NAME%" "%SERVICE_APP_PATH%"
    echo.
    echo Service installed : %APP_NAME%
    echo.
  :END_INSTALL_SERVICE
  
  :UPDATE_REGISTRY
    REG ADD "HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\%APP_NAME%\Parameters" /v "Application" /t REG_SZ /d "%APP_PATH%" /f
    IF NOT "%APP_FOLDER%"=="" REG ADD "HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\%APP_NAME%\Parameters" /v "AppDirectory" /t REG_SZ /d "%APP_FOLDER%" /f
    IF NOT "%APP_PARAM%"=="" REG ADD "HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\%APP_NAME%\Parameters" /v "AppParameters" /t REG_SZ /d "%APP_PARAM%" /f
    echo.
    echo Registry updated to run %APP_PATH% with service %APP_NAME%
    echo.
  :END_UPDATE_REGISTRY
  
  :START_SERVICE
    SET RETURN_DRAW_ATTENTION_POINT=START_SERVICE_INPUT_REQUEST
    GOTO DRAW_ATTENTION
    :START_SERVICE_INPUT_REQUEST
      echo The service is now installed successfully (if no errors are logged above!)
      set INPUT=
      set /p INPUT=To start the service now, press Y. All others will return to main menu: 
      if /i not "%INPUT%" == "y" goto END_START_SERVICE
    :END_START_SERVICE_INPUT_REQUEST
    NET START "%APP_NAME%"
    echo.
    echo Service %APP_NAME% started
  :END_START_SERVICE
  
  GOTO END_START_INSTALL
  
  :DEFAULT_INST_SERVICE_APP_PATH
    echo Using default path for instsrv.exe %INST_SERVICE_APP_PATH%
    SET INST_SERVICE_APP_PATH=%CD%\instsrv.exe
    GOTO END_CHECK_INST_SERVICE_APP_PATH_INPUT
  :END_DEFAULT_INST_SERVICE_APP_PATH
  
  :DEFAULT_SERVICE_APP_PATH
    echo Using default path for srvany.exe %SERVICE_APP_PATH%
    SET SERVICE_APP_PATH=%CD%\srvany.exe
    GOTO END_CHECK_SERVICE_APP_PATH_INPUT
  :END_DEFAULT_SERVICE_APP_PATH
:END_START_INSTALL
  GOTO MAIN_MENU
:START_SERVICES
  start "Services" services.msc
:END_START_SERVICES
  GOTO MAIN_MENU
:START_UNINSTALL
  :INTERACTIVE_INPUT_APP_NAME_UNINSTALL
    echo.
    SET APP_NAME=
    set /p APP_NAME=Provide the name of your custom application (the name of the service to uninstall): 
    echo. 
  :END_INTERACTIVE_INPUT_APP_NAME_UNINSTALL
    
  :INTERACTIVE_INPUT_OF_INST_SERVICE_APP_PATH_UNINSTALL
    echo. 
    SET INST_SERVICE_APP_PATH=
    set /p INST_SERVICE_APP_PATH=Provide the full path to instsrv.exe (don't use quotes). LEAVE EMPTY to use default path (%CD%\instsrv.exe): 
  :END_INTERACTIVE_INPUT_OF_INST_SERVICE_APP_PATH_UNINSTALL
  
  :CHECK_INST_SERVICE_APP_PATH_INPUT_UNINSTALL
    if "%INST_SERVICE_APP_PATH%"=="" goto DEFAULT_INST_SERVICE_APP_PATH_UNINSTALL
  :END_CHECK_INST_SERVICE_APP_PATH_INPUT_UNINSTALL
  
  :CHECK_INST_SERVICE_APP_PATH_UNINSTALL
    IF EXIST "%INST_SERVICE_APP_PATH%" GOTO END_CHECK_INST_SERVICE_APP_PATH_UNINSTALL
    echo.
    echo instsrv.exe could not be found at %INST_SERVICE_APP_PATH%!
    echo Please try again!
    SET RETURN_DRAW_ERROR_ATTENTION_POINT=INTERACTIVE_INPUT_OF_INST_SERVICE_APP_PATH_UNINSTALL
    GOTO DRAW_ERROR_ATTENTION
  :END_CHECK_INST_SERVICE_APP_PATH_UNINSTALL
    COLOR %DFAULT_BACKGROUND_COLOR%%DEFAULT_TEXT_COLOR%
  
  :STOP_SERVICE
    NET STOP %APP_NAME%
    echo.
    echo Service %APP_NAME% stopped
    echo.
  :END_STOP_SERVICE
  
  :REMOVE_SERVICE
    "%INST_SERVICE_APP_PATH%" %APP_NAME% REMOVE
    echo.
    echo Service %APP_NAME% removed
    echo.
  :END_REMOVE_SERVICE
  
  :UPDATE_REGISTRY_UNINSTALL
    REG DELETE HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\%APP_NAME%\ /va /f
    echo.
    echo Registry cleaned up for service %APP_NAME%
    echo.
  :END_UPDATE_REGISTRY_UNINSTALL
  
  GOTO END_START_UNINSTALL
  
  :DEFAULT_INST_SERVICE_APP_PATH_UNINSTALL
    echo Using default path for instsrv.exe %INST_SERVICE_APP_PATH%
    SET INST_SERVICE_APP_PATH=%CD%\instsrv.exe
    GOTO END_CHECK_INST_SERVICE_APP_PATH_INPUT_UNINSTALL
  :END_DEFAULT_INST_SERVICE_APP_PATH_UNINSTALL
:END_START_UNINSTALL
  GOTO MAIN_MENU
  
:EXIT_WITH_PAUSE
  echo The end. Comments and updates: http://myTselection.blogspot.com, Copyright MightyMouse. Copyright srvany and instsrv Microsoft.
  pause
  GOTO EXIT
:END_EXIT_WITH_PAUSE
  
:EXIT
  exit
:END_EXIT
:DRAW_ATTENTION
  COLOR %ATTENTION_BACKGROUND_COLOR%%ATTENTION_TEXT_COLOR%
  @PING 1.1.1.1 -n 1 -w 100 >NUL
  COLOR %DEFAULT_BACKGROUND_COLOR%%DEFAULT_TEXT_COLOR%
  @PING 1.1.1.1 -n 1 -w 100 >NUL
  COLOR %ATTENTION_BACKGROUND_COLOR%%ATTENTION_TEXT_COLOR%
  @PING 1.1.1.1 -n 1 -w 100 >NUL
  COLOR %DEFAULT_BACKGROUND_COLOR%%DEFAULT_TEXT_COLOR%
  @PING 1.1.1.1 -n 1 -w 100 >NUL
  COLOR %ATTENTION_BACKGROUND_COLOR%%ATTENTION_TEXT_COLOR%
  @PING 1.1.1.1 -n 1 -w 100 >NUL
  COLOR %DEFAULT_BACKGROUND_COLOR%%DEFAULT_TEXT_COLOR%
:END_DRAW_ATTENTION
  GOTO %RETURN_DRAW_ATTENTION_POINT%
:DRAW_ERROR_ATTENTION
  COLOR %ERROR_BACKGROUND_COLOR%%ERROR_TEXT_COLOR%
  @PING 1.1.1.1 -n 1 -w 100 >NUL
  COLOR %DEFAULT_BACKGROUND_COLOR%%DEFAULT_TEXT_COLOR%
  @PING 1.1.1.1 -n 1 -w 100 >NUL
  COLOR %ERROR_BACKGROUND_COLOR%%ERROR_TEXT_COLOR%
  @PING 1.1.1.1 -n 1 -w 100 >NUL
  COLOR %DEFAULT_BACKGROUND_COLOR%%DEFAULT_TEXT_COLOR%
  @PING 1.1.1.1 -n 1 -w 100 >NUL
  COLOR %ERROR_BACKGROUND_COLOR%%ERROR_TEXT_COLOR%
  @PING 1.1.1.1 -n 1 -w 100 >NUL
  COLOR %DEFAULT_BACKGROUND_COLOR%%DEFAULT_TEXT_COLOR%
  @PING 1.1.1.1 -n 1 -w 100 >NUL
  COLOR %ERROR_BACKGROUND_COLOR%%ERROR_TEXT_COLOR%
:END_ERROR_DRAW_ATTENTION
  GOTO %RETURN_DRAW_ERROR_ATTENTION_POINT%
@echo on


A full package to easily install your own custom application as a service can be downloaded here, sources (zip).



Update (26/04/09): Added possibility to specify application working directory and command line parameters. (AppDirectory and AppParameter registry keys.)

Update (09/10/2011): New links

Monday, February 23, 2009

Install Windows without disk drive


I've been searching for a long time to find an easy way to install Windows, only by booting from an USB-stick: no disk drive, no floppy disk, no pre-installed version of any OS required. Many resources talk about this on the net, but only one could do everything I needed and is really very easy to use!

The best freeware utility I could find so far is called WinSetupFromUSB. It has a very straightforward GUI and everything you need is included. It allows you to copy source files from a Windows setup image and copy them to your USB stick. Next you can easily boot from the USB stick (if supported by your PC and stick). I was able to install Windows 7 Beta from my USB stick with this nice tool.

Features
  • multiple Windows XP/2kX sources in the same partition (up to 10). They have to be in the first partition of the disk! Existing folders ~BT and ~LS and TXTSETUP.SIF will be renamed, and SETUPLDR.BIN and SETUPDD.SYS patched against the new names. Checksum checks are also corrected. BTS OEM folders are supported and renamed accordingly.
  • BartPE/WinBulder/UBCD4Win/WinFLPC (NOT ramdisk versions) to any primary partition. Multiple BartPE for example, in the SAME partition are NOT supported. Neither is the mix of them on a single partition.
  • Vista setup to different primary partitions. Multiple Vista sources in the SAME partition are NOT supported. Place your second Vista setup in another partition. It can be placed on any primary partition.
  • GParted 0.3.4-8 and 0.3.6-7, excellent open source partition manager.
  • SyLinux bootsector, and optionally folder, containing (Linux) distro, booting off SysLinux. For example you may extract UBCD411.ISO, and point it to this folder. Entire contents will be copied and entry for SysLinux will be added to the boot menu.
  • detects UBCD4Win and uses multiboot menu for it if folder IMAGES is found. Only default UBCD4Win multiboot options are added. Edit UBCD4Win.lst to add custom ones.
  • UBCD4Win boot menu is adjusted to boot from the selected partition. It can be placed on any primary partition.
  • if Windows setup folders (~BT and ~LS) and txtsetup.sif coexist in the same partition as BartPE/WinBuilder/UNCD4Win/WinFLPC, SETUPLDR.BIN of the latter is patched not to use txtsetup.sif in root. Checksum checks are also corrected.
  • grub4dos is the main bootloader/manager. Without it's advanced features, multiple partitions will not be easily achieved.
  • Bootsector loading GRLDR is installed in the active partition of the selected disk. Hence the requirement for active partition and MBR.
  • detailed log file is created in the folder, where program is executed from. Use it for troubleshooting. Upon next execution if log file is found, it's compressed in MS cab format, removed to BACKUPS folder and renamed with current DATE/TIME stamp.
  • upon installing grub4dos bootsector, backup of MBR and bootsector with DATE/TIME stamp are placed in BACKUPS folder. Use it in case something goes wrong.
  • if in Windows source folder winnt.sif or unattend.txt are found they will be used as answer file. Section UNATTENDED will be temporarily removed, only for the Text part of setup, and before start of GUI mode it will be merged back. PRESETUP.CMD is used for this purpose.
  • option to start the prepared USB disk in QEMU for testing purposes. Use carefully at own risk, do not attempt write operations!
  • tooltips on almost every element in the GUI
  • for multi partition USB stick use the cmd files in "files\tools\MULTIpartitionUSBstick". Works for 32bits Windows only! This is not thoroughly tested option, use at your risk.
Please read the included ReadMe.txt, it should help you get started. When in doubt hold the mouse over the element, a tooltip should help you with the choice.