Share via

Deploying Powershell Script using SCCM does not work for X64

Mike Jones 61 Reputation points
2020-10-12T19:17:04.563+00:00

Hi,

I have a script that repairs an application which has a x86 and x64 bit version of it installed. The script checks the folder size as follows:

$FolderX86Size = ((Get-ChildItem "C:\Program Files (x86)\TestApp" -Recurse | Measure-Object -Property Length -Sum).Sum / 1MB)
if($FolderX86Size -lt 20 do repair....

$FolderX64Size = ((Get-ChildItem "C:\Program Files\TestApp" -Recurse | Measure-Object -Property Length -Sum).Sum / 1MB)
if($FolderX64Size -lt 25 do repair....

When I run this script outside of Software Center it is working perfectly. When I run this script deployed as a "package" in SCCM it never tries to repair X64 but works for X86.

Is there something special required to get a script to work or be able to check correctly X64 folders within SCCM? TIA

Microsoft Security | Intune | Configuration Manager | Other
0 comments No comments

Answer accepted by question author

Jason Sandys 31,421 Reputation points Microsoft Employee Moderator
2020-10-13T01:26:34.207+00:00

There's no reason the above shouldn't work to my knowledge as both folders just be accessible from the 32-bit context of packages on 64-bit OSes. You should add logging to your script (perhaps using start-transcript) to capture detailed information and help troubleshoot.

Was this answer helpful?

0 comments No comments

1 additional answer

Sort by: Most helpful
  1. Mike Jones 61 Reputation points
    2020-10-13T18:05:09.9+00:00

    Thank you, I got it working as it was because I didnt specify the sysnative powershell in my command in SCCM.

    Was this answer helpful?

    0 comments No comments

Your answer

Answers can be marked as 'Accepted' by the question author and 'Recommended' by moderators, which helps users know the answer solved the author's problem.