0

So, I am having a quite interesting issue. I deploy a PowerShell script what is packaged as a Win32APP (appname.intunewin) and it is deployed as "System" context. - tried "user" as well. A filename.cmd is used to execute it.

CMD:

@echo off
powershell -ExecutionPolicy bypass -command "&{.\TestPopUp.ps1}"

PowerShell:

Set-ExecutionPolicy -ExecutionPolicy Bypass -Force
$TPath = "C:\ProgramData\ScriptTest"
$TPR=Test-Path -Path $TPath
if ($TPR -ne "true"){
    $wshell = New-Object -ComObject Wscript.Shell
    $Output = $wshell.Popup("This is a Text",0,"Header it is!",0+16)
    New-Item -Path $TPath -ItemType Directory -InformationAction SilentlyContinue | Out-Null
}

When I run the script locally with Admin rights, I get the pop-up, it creates the folder aso.

When I deploy the script as 'System' it seems to run according the log but it fails to create the folder nor creating the popup - as Intune uses the folder existence as detection method, it will say it failed.

Deploy as user contex fails even according log.

Devices are Intune managed, fully managed VMs and physical devices. Some are even Co-Managed.

Maybe someone can point me into the right direction here, because I hit a wall.

  • Cheers -
Jeaninez - MSFT
  • 3,210
  • 1
  • 5
  • 20
  • Are there any popups or error messages under the SYSTEM account? I presume you want to do a silent install (**/Quiet**). If you actually looking for how to troubleshoot installations under the SYSTEN account, you might have a look at: [Scheduled Task Powershell Script - Runs OK as user account, but not as SYSTEM](https://stackoverflow.com/a/51612478/1701026) – iRon Jul 08 '22 at 12:38
  • No, I want to display a pop-up message and the user has to press 'OK' to close it. I just deployed it as a 'Script' in Intune without wrapping it, but Intune being Intune, the deployments take always ages till shown on the device... – B0RN2SL0W Jul 08 '22 at 12:49
  • For security reasons, it not easy (and also not recommended) to interact between a user and the system account. Nevertheless you might check this question/answer [Powershell interaction between SYSTEM user and logged on users](https://stackoverflow.com/a/56254256/1701026) – iRon Jul 08 '22 at 13:18
  • @iRon OK, thanks for the link, I'll have a look. – B0RN2SL0W Jul 08 '22 at 14:20

0 Answers0