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 -