cancel
Showing results for 
Search instead for 
Did you mean: 
autox19
Pilgrim

Powershell not working

when I put powershell into a custom action, the script doesn't work. it is a simple script to use 7 zip to zip up a file. I put 2 message boxes in the script for trouble shooting. one before it zips, the other after it is done. the first one fires off. then IS just says installation is complete even though the zip never shows up. the reason I am putting this in the IS forum and not powershell, is if I run the script manually on the target server, it runs correctly (takes about 2 min to zip)

any thoughts?


Odie
Farm bureau Insurance of Michigan
Labels (1)
0 Kudos
2 Replies
PlinyElder
Pilgrim

Re: Powershell not working

I know ive had powershell script problems in the past and it was always because Installshield start powershell in 32bit mode when on 64bit machines.
0 Kudos
autox19
Pilgrim

woo hoo!!

On the nose!!!

I found this that will change it to 54 bit if it is in 32 bit mode. works great


1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
# am I running in 32 bit shell?
if ($pshome -like "*syswow64*") {
write-warning "Restarting script under 64 bit powershell"

# relaunch this script under 64 bit shell
# if you want powershell 2.0, add -version 2 *before* -file parameter
& (join-path ($pshome -replace "syswow64", "sysnative") powershell.exe) -file `
(join-path $psscriptroot $myinvocation.mycommand) @args

# exit 32 bit script
exit
}

# start of script for 64 bit powershell

write-warning "hello from $pshome"

rite-warning "My original arguments $args"


thanks
Odie:)


PlinyElder wrote:
I know ive had powershell script problems in the past and it was always because Installshield start powershell in 32bit mode when on 64bit machines.
0 Kudos