-
-
Notifications
You must be signed in to change notification settings - Fork 11
Description
I'm really struggling to get this working properly with XML objects [[]xml[]]. So if I have as a simple example. I also tried an external powershell file and got an error also, but no less detail in the log.
if ($null -eq $null) {
[[]xml[]](Get-Content $CurrentConfig)
}
It is transformed to this in the msiexec log where it prints the script being run:
if ($null -eq $null)
(Get-Content $CurrentConfig)
}
So it is now missing "{ [[]xml[]]", so both the opening brace of the block, and the expected [xml] are gone.
Looking at the msiexec verbose log, the powershell script being executed is logged, and the script not only has the [[]xml[]] removed, the preceding { on the if statement has been removed also.
See the attached fragment 1.txt - It doesn't paste as code
The log section from msiexec is in the fragment 2.txt. It won't paste inline.
If I run the script from a file (using directly [xml]), I get this:
MSI (s) (DC:F4) [12:45:15:932]: Executing op: CustomActionSchedule(Action=PowerShellFilesDeferred,ActionType=1025,Source=BinaryData,Target=PowerShellFilesDeferred,CustomActionData=xml=<r> <d Id="UpdateBindings" file="" args="" IgnoreErrors="0" /> </r>) MSI (s) (DC:F8) [12:45:15:934]: Invoking remote custom action. DLL: C:\WINDOWS\Installer\MSI18D1.tmp, Entrypoint: PowerShellFilesDeferred SFXCA: Extracting custom action to temporary directory: C:\WINDOWS\Installer\MSI18D1.tmp-\ SFXCA: Binding to CLR version v4.0.30319 Calling custom action PowerShellActions!PowerShellActions.CustomActions.PowerShellFilesDeferred PowerShellFilesDeferred start PowerShell terminating error, returning Failure System.Management.Automation.RuntimeException: The expression after '&' in a pipeline element produced an object that was not valid. It must result in a command name, a script block, or a CommandInfo object. at System.Management.Automation.Runspaces.PipelineBase.Invoke(IEnumerable input) at PowerShellActions.PowerShellTask.Execute() at PowerShellActions.CustomActions.FilesDeferred(Session session, String deferredProperty) CustomAction PowerShellFilesDeferred returned actual error code 1603 (note this may not be 100% accurate if translation happened inside sandbox) Action ended 12:45:16: InstallFinalize. Return value 3. MSI (s) (DC:F4) [12:45:16:724]: Note: 1: 2265 2: 3: -2147287035