NiCE Library Install MSI locally WriteAction

NiCE.Library.W.Install.MSI.Locally.WA (WriteActionModuleType)

WriteAction to run installation local. MSI file must exsits already on this computer.

Element properties:

TypeWriteActionModuleType
IsolationAny
AccessibilityPublic
RunAsDefault
InputTypeSystem.BaseData
OutputTypeSystem.BaseData

Member Modules:

ID Module Type TypeId RunAs 
InstallMSI WriteAction Microsoft.Windows.PowerShellWriteAction Default

Overrideable Parameters:

IDParameterTypeSelectorDisplay NameDescription
InstallDirectorystring$Config/InstallDirectory$Install DirectoryDirectory where the msi should be installed. If not set, default location will be used.

Source Code:

<WriteActionModuleType ID="NiCE.Library.W.Install.MSI.Locally.WA" Accessibility="Public" Batching="false">
<Configuration>
<xsd:element xmlns:xsd="http://www.w3.org/2001/XMLSchema" minOccurs="1" name="MSISourcePath" type="xsd:string"/>
<xsd:element xmlns:xsd="http://www.w3.org/2001/XMLSchema" minOccurs="1" name="InstallDirectory" type="xsd:string"/>
</Configuration>
<OverrideableParameters>
<OverrideableParameter ID="InstallDirectory" Selector="$Config/InstallDirectory$" ParameterType="string"/>
</OverrideableParameters>
<ModuleImplementation Isolation="Any">
<Composite>
<MemberModules>
<WriteAction ID="InstallMSI" TypeID="Windows!Microsoft.Windows.PowerShellWriteAction">
<ScriptName>NiCEInstallMSILocal.ps1</ScriptName>
<ScriptBody><Script>Param(
[string]$MSISourcePath,
[string]$InstallDirectory,
[string]$Uninstall
)
$Installmode = "/i"
if($Uninstall)
{
$Installmode = "/x"
}

#Prepare msi arguments
$arguments = @(
"$Installmode"
"`"$MSISourcePath`""
"/quiet"
"/norestart"
"/log"
"`"Instrumentation.log`""
)

#Add install directory if provided
if ($InstallDirectory)
{
$arguments += "INSTALLDIR=`"$InstallDirectory`""
}

#Run installation
$process = Start-Process -FilePath msiexec.exe -ArgumentList $arguments -Wait -PassThru

if ($process.ExitCode -eq 0)
{
If($Uninstall)
{
Write-Host "Deinstallation was successfully."
}
else
{
Write-Host "Installation was successfully."
}
}
else
{
Write-Host "Installer exit code $($process.ExitCode)`n"
Get-Content -Path "Instrumentation.log"
}

Remove-Item -Path "Instrumentation.log"
</Script></ScriptBody>
<Parameters>
<Parameter>
<Name>MSISourcePath</Name>
<Value>$Config/MSISourcePath$</Value>
</Parameter>
<Parameter>
<Name>InstallDirectory</Name>
<Value>$Config/InstallDirectory$</Value>
</Parameter>
</Parameters>
<TimeoutSeconds>600</TimeoutSeconds>
</WriteAction>
</MemberModules>
<Composition>
<Node ID="InstallMSI"/>
</Composition>
</Composite>
</ModuleImplementation>
<OutputType>System!System.BaseData</OutputType>
<InputType>System!System.BaseData</InputType>
</WriteActionModuleType>