I am having an odd issue that I can't figure out.
I have a simple get-process line to get a process for all users that have it running:
It works well when ran directly as a ps1.
Code: [Select all] [Expand/Collapse] [Download] (Untitled.ps1)
- $QBWUsers = Get-Process -Name QBW32 -IncludeUserName -ErrorAction SilentlyContinue | select -ExpandProperty Username
However, when I package it as an exe, with another user's credentials (impersonation), this statement always returns one user only, regardless of whether there are more users that should be returned.
If I run the ps1 on the impersonated user, it also returns the correct results, so the issue is only returning a different result when ran as an exe.
Any ideas what I might be doing wrong with the packager that could cause this behavior? As far as I know, the Get-Process command should query all processes regardless of the context of the user running it.
My Packager is set to :
Microsoft Windows (32 bit)
SAPIEN Powershell V5 Host (Silent)
Embed a default manifest
Alternate Credentials Set
Run Mode: Impersonate User