Question on architecture awareness

Topics: Archive - General
Nov 27, 2013 at 9:35 PM
Edited Nov 27, 2013 at 9:36 PM
I deal with a mix of 32-bit and 64-bit clients, so I'm finding that some scripts fail due to null values for some variables. One of these is likely the programfiles dir. I noticed the sample script assumes a 64-bit platform - is there a better (more dynamic) way to handle setting these variables that accounts for architecture without creating a lot of if statements?

example (assumes 64-bit):

$dirOffice = Join-Path "${env:ProgramFiles(x86)}" "Microsoft Office"
Nov 28, 2013 at 11:14 AM
Hadn't factored that in for the example, apologies.

In the next release, I've added handling of X86 environment variables so that $envProgramFilesX86 will return "C:\Program Files (x86)" on x64 and "C:\Program Files" on x86. You shouldn't get empty variables any more.

Cheers, Dan