> Date: Tue, 25 Nov 2008 14:10:24 -0500
> From: "Castro, Edwin (Hillsboro)" <[EMAIL PROTECTED]>
> Subject: [WiX-users] Executing a PowerShell Script as Custom Action

> I'm trying to execute a powershell script as custom action and I see
> the powershell.exe process starts but then it appears to be doing
> nothing. Here's an example:
>
<snip>
> I would expect powershell to print a value to its console and
> exit quickly. Instead, powershell.exe appears to hang until
> terminated manually. Am I doing something wrong?

Hi Edwin,

I've run into this same problem.  If I remember correctly, it was because I had 
a 64-bit install but the version of powershell that was being executed was 
32-bit (or the other way around).

I know I ended up creating a vbscript custom action which I marked with 
Win64="yes".  Then this picked up the correct version (64-bit in my case) of 
powershell.

Here's a snippet of my script.  The syntax for calling powershell scripts from 
cmd.exe is a bit tricky so I've included it.

  cmdshell = "cmd.exe /c "
  cmd = cmdshell & "echo " & action & " agents in Microsoft Exchange.  This may 
take several minutes... & powershell.exe -Command " & chr(34) &  ". " & chr(39) 
& script_dir & "AgentMain.ps1" & chr(39) & " " & action & chr(34)
  ret = oShell.Run(cmd,1,true)
  ' ret is kind of useless here since Powershell doesn't seem to propogate it's 
exit status to cmd.exe


Hope this helps.
Dale


-------------------------------------------------------------------------
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK & win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100&url=/
_______________________________________________
WiX-users mailing list
WiX-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/wix-users

Reply via email to