Reference: MyInstall Config


So before we get too involved into the usage of MyInstall.vbs, lets make a Reference.  I’ll try my hardest to keep this updated, so lets start out with this line:

What is in the MyInstall.config file?


Header

'// This config file is in VBScript format

The only thing that changes is the date, which will show when the Config file was generated.


Script Properties

'====== MyInstall Script Properties ====================================
 cSimulation = True
 cConfirm = True
 cElevate = True

Defaults are listed above.  Valid entries are True or False, nothing else can be set, not even a blank entry

cSimulation controls whether or not MyInstall will actually run the Install.  Think of this as your Safety.

cConfirm controls the confirmation prompt before and after the installation

cElevate controls whether or not the Install should invoke UAC on supported Operating Systems.  MDT already runs elevated so no UAC prompt is ever displayed during a Task Sequence


Setup File Information

'====== Setup File Information =========================================
 cSetupFile = "Source\Sample.exe"
 cSetupx86 = ""
 cSetupx64 = ""

Defaults are listed above.  Entries must be in quotes

cSetupFile is the Install file in relation to the MyInstall.vbs script.  It is recommended that Install files are placed in a Source subdirectory of MyInstall.vbs.  The default Sample.exe is ignored in processing.  This entry supersedes cSetupx86 and cSetupx64 and must be cleared if those entries are used instead.  Remember to leave the quotes.


cSetupx86 is the Install file for x86 installations only.  This entry can be used with cSetupx64, but not cSetupFile.  In the example below, an installation is only compatible with x86 Operating Systems, so having the Install file in cSetupx86 restricts this application to only install on 32 Bit systems.

'====== Setup File Information =========================================
 cSetupFile = ""
 cSetupx86 = "Source\Setup32.exe"
 cSetupx64 = ""

cSetupx64 is the Install file for x64 installations only.  This entry can be used with cSetupx86, but not cSetupFile.


In the example below, separate installations exist for x86 and x64.  When using this method, cSetupFile must be cleared out

'====== Setup File Information =========================================
 cSetupFile = ""
 cSetupx86 = "Source\MBSASetup-x86-EN.msi"
 cSetupx64 = "Source\MBSASetup-x64-EN.msi"

Setup Switches

'====== Setup Switches =================================================
 cSetupSwitches = ""

This is easy and difficult to detail at the same time . . . but I’ll give it a go.  Don’t be a hero and try to add MSI switches, as everything is done for your by MyInstall.vbs, but you can add a Transform in here.  The main thing to remember is that this is a VB Script, not a Text file, so you run into some challenges when you have quotes.


It is very easy to do a normal Passive Setup Switch that will display a Progress Bar, but no Prompts

'====== Setup Switches =================================================
 cSetupSwitches = "/passive"

The challenge comes when you need to have the switches /q:a “/c:install.exe /q” to install Microsoft Report Viewer 2005 SP1.  To do that here, you need to remember to escape quotes properly.  So that would translate to

'====== Setup Switches =================================================
 cSetupSwitches = "/q:a ""/c:install.exe /q"""

or alternatively you could use the chr(34) instead

'====== Setup Switches =================================================
 cSetupSwitches = "/q:a " & chr(34) & "/c:install.exe /q" & chr(34)

Ok, so now that is out of the way.  Now what about an InstallShield ISS file where you would need to use -s -f1″C:\Windows\Temp\Setup.iss”

That would translate to this mumbo jumbo

'====== Setup Switches =================================================
 cSetupSwitches = "-s -f1""C:\Temp\Setup.iss"""

Now that’s just silly, but to make up for this challenge, MyInstall.vbs allows you to use %MyScriptParentFolder% as a Variable in this line to represent the location of the MyInstall.vbs file when you have to use a literal path for an InstallShield ISS file.  That’s something right?  Don’t get creative and put stuff like %Windir% or %Temp% as this entry is handled by the VB Script Replace function.  It doesn’t use Environment Variables like you think it should.

'====== Setup Switches =================================================
 cSetupSwitches = "-s -f1""%MyScriptParentFolder%\Source\Setup.iss"""

Local Path

'====== Local Path =====================================================
 cLocalPath = "C:\Sample"

Default listed above.  C:\Sample is ignored in processing.

Now let’s say you have an application that cannot run from a Network Share or UNC Path.  For example Cisco VPN Client.  This is because when you install a VPN Client, it will take the Network Stack offline during the install, which in most cases will fail (smacks head).  So change this to an entry that will make you happy and move on with more important things.  Be aware that content in here will not be removed after the installation is complete

'====== Local Path =====================================================
 cLocalPath = "C:\Windows\Local"

Running Processes

'====== Running Processes ==============================================
 cWaitForProcess = "SampleProcess.exe"

Default listed above.  SampleProcess.exe is ignored in MyInstall.vbs processing

This works great if you have an installation that quits, but really didn’t quit, so MDT starts installing the next application.  I have seen this happen when installing Config Manager.  Simply give the name of an EXE to look for in Processes and it will monitor every 10 seconds.  When this process is not running anymore, MyInstall.vbs will finish the installation.

'====== Running Processes ==============================================
 cWaitForProcess = "ccmsetup.exe"

Reboot Action

'====== Reboot Action ==================================================
 cRebootWithMDT = False

Default listed above

This actually takes a bit of work to run.  In CustomSettings.ini, you should create an entry  ApplicationSuccessCodes so that you have 1641.  By default 0 and 3010 are automatically included for your applications (which you can also modify in your Task Sequence by Step)

[Settings]
Priority=Default
Properties=MyCustomProperty

[Default]
ApplicationSuccessCodes = 0 1641 3010

So what do these Success Codes mean?

  • 0 ERROR_SUCCESS
  • 1641 ERROR_SUCCESS_REBOOT_INITIATED
  • 3010 ERROR_SUCCESS_REBOOT_REQUIRED

Personally I prefer to add a wide range of Application Success Codes so an install does not destroy my Task Sequence, but that is up to you.

[Settings]
Priority=Default
Properties=MyCustomProperty

[Default]
ApplicationSuccessCodes = 0 1 2 4 8 16 43 69 193 1603 1641 3010

Now MDT will normalize a 3010 to 0, unless you check Reboot the computer after installing this application in the Application Properties.

6-23-2015 10-00-36 PM

This is handled in DeployRoot\Scripts\ZTIApplications.wsf.  For starters we have to add a trap for Error Code 1641 at like 458.

6-24-2015 10-20-29 AM

Here is my addition

'=======================================================================
 'Segura - MyInstall.vbs Modifications
 ElseIf iResult = 1641 Then
 oLogging.CreateEvent 41033, LogTypeInfo, "Application " & oUtility.SelectSingleNodeString(oNode,"Name") & " installed successfully. Reboot Initiated", Array(sGuid, oUtility.SelectSingleNodeString(oNode,"Name"), iResult)
'=======================================================================

Secondly you will need to add another block at the end of the Function

6-24-2015 10-23-48 AM

Using this code

'=======================================================================
 'Segura - MyInstall.vbs Modifications
 If iResult = 1641 Then
 oLogging.CreateEntry "(MyInstall) Reboot Exit Code. Rebooting", LogTypeInfo
 InstallApplication = 3010
 End If
'=======================================================================

You can download the original and updated ZTIApplications.wsf for Microsoft Deployment Toolkit 2013 on my GitHub

Once you make this change to your ZTIApplications, and enable cRebootWithMDT, then your application will gracefully restart the computer if it is installed.  This is very helpful when you have a bundle with several conditional applications and you don’t want to invoke a reboot, if it wasn’t installed.

'====== Reboot Action ==================================================
 cRebootWithMDT = True

Operating System Compatibility

'====== Operating System Compatibility =================================
 cOSWindowsXP = True
 cOSWindowsVista = True
 cOSWindows7 = True
 cOSWindows8 = True
 cOSWindows81 = True
 cOSWindows10 = True

Default listed above

Obviously change this to False if you do not want MyInstall.vbs to install the application for a specific OS.  Future updates will include Server OS’s


Hardware Compatibility

'====== Hardware Compatibility =========================================
 cComputerManufacturer = ""
 cComputerModel = ""
 cComputerPNPID = ""

cComputerManufacturer controls whether or not an application will be installed for a specific Make.  Currently Dell and Microsoft are normalized, meaning that If a Make has the word Dell in it (Dell Inc. or Dell Computer Corporation) you should just put Dell.  If a Make has Microsoft in it (Surface Pro or Hyper-V) then just put Microsoft.  Everything else has to be exact.  As I am in an Enterprise that only has Dell or Microsoft, those are the only ones I normalize, but I would be more than happy to code in HP or Lenovo if necessary.  This is a Comma Separated field, so if I wanted this to run for Dell and Lenovo computers only, I would use the entry below

'====== Hardware Compatibility =========================================
 cComputerManufacturer = "Dell,Lenovo"
 cComputerModel = ""
 cComputerPNPID = ""

cComputerModel is what ZTIGather defines as Model, which is the WMIC Computer Model.  So if I wanted an application to install on my Precision M4800 only, and no other model, then I would put in Precision M4800 in the quotes.  Again, this is a Comma Separated field, so if I wanted this to run for multiple Models, I would use the entry below

'====== Hardware Compatibility =========================================
 cComputerManufacturer = ""
 cComputerModel = "Latitude E6440,Latitude E6540,Latitude E7440"
 cComputerPNPID = ""

Additionally I have a MyInstall.models.txt.sample file that was created when I first ran MyInstall.vbs.  Simply add the Computer Models you want on each line, then rename this file to MyInstall.models.txt.  This sample file may also be deleted if it is not necessary.

Latitude E6430
Latitude E6530
Latitude E6440
Latitude E6540

cComputerPNPID is used to check for Hardware on a computer.  So let’s say I have an application for Realtek High Definition Audio Codecs.  I can either put a full or partial PNPID in this field and if the hardware exists, it will install the application.

'====== Hardware Compatibility =========================================
 cComputerManufacturer = ""
 cComputerModel = ""
 cComputerPNPID = "HDAUDIO\FUNC_01&VEN_10EC"

This is a single entry, but if I have multiple PNPID’s I need to check for, then I simply use the MyInstall.pnpids.txt.sample instead.  Rename this file to MyInstall.pnpids.txt and MyInstall.vbs will use that instead.

HDAUDIO\FUNC_01&VEN_10EC&DEV_0269&SUBSYS_1028052C
HDAUDIO\FUNC_01&VEN_10EC&DEV_0280&SUBSYS_102805A1
HDAUDIO\FUNC_01&VEN_10EC&DEV_0280&SUBSYS_102805D2
HDAUDIO\FUNC_01&VEN_10EC&DEV_0280&SUBSYS_102805D3
HDAUDIO\FUNC_01&VEN_10EC&DEV_0280&SUBSYS_102805D4
HDAUDIO\FUNC_01&VEN_10EC&DEV_0280&SUBSYS_10280620

BIOS Compatibility

'====== BIOS Compatibility =============================================
 cComputerBIOSVerMin = "A99"
 cComputerBIOSVerMax = "A99"

Default listed above.  A99 is ignored in processing, so no need to change this if you are not using it.

cComputerBIOSVerMin is used to note the minimum BIOS Version that is allowed to install an Application.

cComputerBIOSVerMax is used to note the maximum BIOS Version that is allowed to install an Application.

This is better explained when using MyInstall.vbs to update the BIOS.  So let’s say my computer is at BIOS Version A14 and new new version is A15.  I would set the entry like this

'====== BIOS Compatibility =============================================
 cComputerBIOSVerMin = "A00"
 cComputerBIOSVerMax = "A14"

Since we stop the Maximum at A14, if the computer is already at A15, it will not process the update since it exceeds the Maximum version.


Shortcut Creation

'====== Shortcut Creation ==============================================
 cShortcut1Location = ""
 cShortcut1TargetPath = ""
 cShortcut1WorkingDir = ""
 '===============================================================
 cShortcut2Location = ""
 cShortcut2TargetPath = ""
 cShortcut2WorkingDir = ""
 '===============================================================
 cShortcut3Location = ""
 cShortcut3TargetPath = ""
 cShortcut3WorkingDir = ""

MyInstall.vbs can create up to 3 shortcuts as part of the installation.

cShortcut*Location is the location to place the LNK file

cShortcut*TargetPath is the location of the target file

cShortcut*WorkingDir is the working directory of the target file

So using this example below, I can create a Shortcut.  Sorry, Environment Variable paths like %windir% are not supported in this release.

'====== Shortcut Creation ==============================================
 cShortcut1Location = "C:\Users\Public\Desktop\Shortcut.lnk"
 cShortcut1TargetPath = "C:\Program\MyProgram.exe"
 cShortcut1WorkingDir = "C:\Program"
 '===============================================================
 cShortcut2Location = ""
 cShortcut2TargetPath = ""
 cShortcut2WorkingDir = ""
 '===============================================================
 cShortcut3Location = ""
 cShortcut3TargetPath = ""
 cShortcut3WorkingDir = ""

Script Information

'====== Script Information (No changes should be made below) ===========
 cScriptVersion = 20150624

cScriptVersion is date of the Script Version.  If the cScriptVersion in MyInstall.config is older than the Version of MyInstall.vbs, and the location that the files are in is writable (so not during an MDT Deployment), the MyInstall.config will be updated (to include new features as needed), retaining all your settings.  So if you get a new MyInstall.vbs in July and your old version is from June, you can change the cSimulation property to False (to prevent installing) and then execute the MyInstall.vbs to perform the update.


About

'====== About ==========================================================
'// MyInstall.vbs Configuration File
'// MyInstall.config Last Updated 20150624
'// 
'// David Segura
'// https://winpeguy.wordpress.com/2015/06/24/reference-myinstall-config/
'// 
'// Supported Extensions for this script are *.*/BAT/CMD/EXE/MSI/MSP/MSU/INF/VBS

MyInstall.config Last Updated will always display when the MyInstall.config was created.  The rest is informational only.  You also get a link back to this page for reference.


Default MyInstall.config

Here is the entire default MyInstall.config for your viewing pleasure.

'// This config file is in VBScript format

'====== MyInstall Script Properties ====================================
 cSimulation = True
 cConfirm = True
 cElevate = True

'====== Setup File Information =========================================
 cSetupFile = "Source\Sample.exe"
 cSetupx86 = ""
 cSetupx64 = ""

'====== Setup Switches =================================================
 cSetupSwitches = ""

'====== Local Path =====================================================
 cLocalPath = "C:\Sample"

'====== Running Processes ==============================================
 cWaitForProcess = "SampleProcess.exe"

'====== Reboot Action ==================================================
 cRebootWithMDT = False

'====== Operating System Compatibility =================================
 cOSWindowsXP = True
 cOSWindowsVista = True
 cOSWindows7 = True
 cOSWindows8 = True
 cOSWindows81 = True
 cOSWindows10 = True

'====== Hardware Compatibility =========================================
 cComputerManufacturer = ""
 cComputerModel = ""
 cComputerPNPID = ""

'====== BIOS Compatibility =============================================
 cComputerBIOSVerMin = "A99"
 cComputerBIOSVerMax = "A99"

'====== Shortcut Creation ==============================================
 cShortcut1Location = ""
 cShortcut1TargetPath = ""
 cShortcut1WorkingDir = ""
 '===============================================================
 cShortcut2Location = ""
 cShortcut2TargetPath = ""
 cShortcut2WorkingDir = ""
 '===============================================================
 cShortcut3Location = ""
 cShortcut3TargetPath = ""
 cShortcut3WorkingDir = ""




'====== Script Information (No changes should be made below) ===========
 cScriptVersion = 20150624

'====== About ==========================================================
'// MyInstall.vbs Configuration File
'// MyInstall.config Last Updated 20150624
'// 
'// David Segura
'// https://winpeguy.wordpress.com/2015/06/24/reference-myinstall-config/
'// 
'// Supported Extensions for this script are *.*/BAT/CMD/EXE/MSI/MSP/MSU/INF/VBS

Enjoy!

Advertisements