ConfigMgr PowerShell App Detect doesn't recognize basic cmdlets

Morrissey, Evan 301 Reputation points
2022-12-05T16:46:47.397+00:00

PowerShell app detection is returning this error:

Script Execution Returned :4294967295, Error Message: Test-Path : The term 'Test-Path' is not recognized as the name of a cmdlet, function, script file, or operable
program. Check the spelling of the name, or if a path was included, verify that the path is correct and try again.
At C:\WINDOWS\CCM\SystemTemp\a0b3a520-1723-4edf-94a8-ebe56b7291a5.ps1:1 char:5

  • if (Test-Path 'C:\Program Files\Elastic\Agent\data\elastic-agent-190a ...
  • ~~~~~~~~~
  • CategoryInfo : ObjectNotFound: (Test-Path:String) [], CommandNotFoundException
  • FullyQualifiedErrorId : CommandNotFoundException

. [AppDT Id: ScopeId_21336A7E-14EC-4584-9D02-BD6D61ACE090/DeploymentType_cd165e2f-952b-4c77-80a1-4f092d659ff7, Revision: 51]

I also have errors for Get-ChildItem, Get-WmiObject, etc. All pretty basic cmdlets. Devices with the same OU, Collections and Group Policies may work without any errors, so I'm really confused whats' causing this. My laptop works, my desktop gives these errors, but they're in the same OU, same GPOs applied, same deployments, etc.

Script signing is not required on our domain, Client Agent is set to Bypass, script was directly written through the GUI

Any ideas?

Microsoft Security Intune Configuration Manager Application
0 comments No comments
{count} votes

1 answer

Sort by: Most helpful
  1. Sherry Kissinger 5,526 Reputation points
    2022-12-06T16:21:34.347+00:00

    For something else (I forget what, but it wasn't powershell), where it was working for some and not other boxes to find cmds... it boiled down to the PATH= statement being either really long (something kept adding more and more to the 'beginning' of the PATH statement, so that %windir%, and etc were bumped so far down that the OS couldn't resolve them), or the PATH= entry had bad characters in it, causing it to choke at that point, and again, not be able to resolve for paths past the invalid character.

    So... just for fun, check your path on your desktop, under the "can't hurt to look" philosophy. Compare the PATH= between the laptop and desktop.

    0 comments No comments

Your answer

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