MAKEMSI quickly and reliably creates MSI files in a non-programmatic way
Have your say! Join the MAKEMSI discussion list or view archive! Suggest improvements. No question too simple or too complex.
[Bottom][Contents][Prev]: Query MSI Table Data[Next]: No Installation Registration
Have your say! Join the MAKEMSI discussion list or view archive! Suggest improvements. No question too simple or too complex.
\->Tips and Tricks->Testing Under the Local System Account

Testing Under the Local System Account

If your MSIs normally get automatically deployed and installed under the SYSTEM account then you would probably want to test your MSIs in a manner as close as possible to this.

To do any initial testing (particularly while developing or modifying the MSI), the deployment process is probably either impossible or too time (or effort) consuming for you to duplicate the "proper" install mechanism.

Once you have opened up a command prompt you can then install the MSI. Just remember to add any MSI properties or flags that the deployment process might add to the MSIEXEC.EXE command line ("ALLUSERS=1" is probably one you will always need unless this is built into your MSIs).

I have described all of the ways I have used to open command prompts under the local system account as one or more may fail on some machines. If none of the approaches works (which I have seen on some boxes), this will likely be because of policies on the box preventing it.

Use Batch File With 'SC.EXE'

This batch file requires "SC.EXE" to be available:

@echo off
@REM ************************************************************************
@rem *** Version 08.240, written By: Dennis Bareis (dbareis at gmail.com) ***
@rem *** BASED ON "http://blogs.msdn.com/adioltean/articles/271063.aspx"  ***
@REM ************************************************************************
cls
SetLocal
for %%x in (".") do set  CurrentDir=%%~fx
set ServiceDesc=$CMD.EXE (under SYSTEM account)
set  ServiceCmd=cmd.exe /C start \"%ServiceDesc% - %CurrentDir%\" CMD.EXE /K CD /D "%CurrentDir%"
sc.exe create $LocalSystem binpath= "%ServiceCmd%" type= own type= interact DisplayName= "%ServiceDesc%"
sc.exe start  $LocalSystem
sc.exe delete $LocalSystem

The batch file will open the prompt at the current directory. Just ignore the error message that may (probably will) appear (as long as the new command prompt opens) as "CMD.EXE" wasn't designed to be used as a service.

Use SysInternals 'PsExec.EXE'

This shows how ths sysinternals program "PSEXEC.EXE" can be used to open a command prompt running under the system account:

PsExec.exe -s CMD.EXE

The above step does create a permanent service which runs "PSEXESVC.EXE".

Use 'CmdAsUser.EXE'

This program (available from "http://www.pluralsight.com/books/pws/samples.htm") allows you to open up a Windows command prompt running under the SYSTEM account (or any other user account).

The command to use is:

CmdAsUser.exe LocalSystem


Microsoft awarded me an MVP (Most Valuable Professional award) in 2004, 2005, 2006, 2007, 2008 & 2009 for the Windows SDK (Windows Installer) area.Please email me any feedback, additional information or corrections.
See this page online (look for updates)

[Top][Contents][Prev]: Query MSI Table Data[Next]: No Installation Registration


MAKEMSI© is (C)opyright Dennis Bareis 2003-2008 (All rights reserved).
Saturday December 09 2017 at 9:30am
Visit MAKEMSI's Home Page
Microsoft awarded me an MVP (Most Valuable Professional award) in 2004, 2005, 2006, 2007, 2008 & 2009 for the Windows SDK (Windows Installer) area.