Error 60008 with Invoke-AppDeployToolkit.exe , Invoke-AppDeployToolkit.ps1 is running fine

Hi,

I have created a dynamic 7-Zip installer, which always checks for the latest version.
We want to use it with Intune.

But at the moment i have the problem running the Installation or Uninstall via Invoke-AppDeployToolkit**.exe**

I always get the Error 60008
When i Run it via Invoke-AppDeployToolkit.ps1 it just running fine.

I cant see anything in the install log.

EDIT:
Exit Codes · PSAppDeployToolkit

60008: The -UserName parameter in the Start-ADTProcessAsUser function has a default value that is empty because no logged in users were detected when the toolkit was launched.

EDIT2:
Found the LOG, but it doesnt help

Commencing invocation of C:\DEV\Intune\Apps\7-zip\Invoke-AppDeployToolkit.ps1.
Administrator rights are required. The verb 'RunAs' will be used with the invocation.
No '-File' parameter specified on command-line. Adding parameter '-File "C:\DEV\Intune\Apps\7-zip\Invoke-AppDeployToolkit.ps1"'...
Executable Path: C:\WINDOWS\system32\WindowsPowerShell\v1.0\PowerShell.exe
Arguments: -ExecutionPolicy Bypass -NoProfile -NoLogo -WindowStyle Hidden -File "C:\DEV\Intune\Apps\7-zip\Invoke-AppDeployToolkit.ps1" Install
Working Directory: C:\DEV\Intune\Apps\7-zip\
An error occurred while running Invoke-AppDeployToolkit.ps1. Exit code: 60008

Coincidentally, I just resolved [Bug] Invoke-AppDeployToolkit.exe exit code 60008 when running from pwsh.exe · Issue #1204 · PSAppDeployToolkit/PSAppDeployToolkit · GitHub.

Could you possibly be trying to start Invoke-AppDeployToolkit.exe from within PowerShell 7?

Just read quickly over it.
should it work in PS7 7, it doesnt.

EDIT:
Okay, it doesnt work with PS7 but should work from cmd or PS5
(I have an error in my installation script, so it doesn’t run succesful, but this is selfmade)

So as far as i understand i do not have a problem with it, when running the installation from intune.
Additionally it will be fixxed in one of the next versions.

Thank you

I’m not saying it should work any better in PowerShell 7, I was just asking if this was your workflow as the GitHub reporter had a problem where his script worked fine, but not with the exe, but only when starting the exe via PowerShell 7.

What I’d recommend you do is turn on system-wide transcription and review PowerShell’s transcribed output, possibly providing the output here so we can assist further. This can be enabled via gpedit.msc, the info on the group policy item is here: Turn on PowerShell Transcription

Hi,
it creates 2 transcripts

First:

**********************
nStart der Windows PowerShell-Aufzeichnung
Startzeit: 20241220001316
Benutzername: WORKGROUP\SYSTEM
RunAs-Benutzer: WORKGROUP\SYSTEM
Konfigurationsname: 
Computer: ************** (Microsoft Windows NT 6.2.9200.0)
Hostanwendung: C:\DEV\Intune\Apps\7-zip\Invoke-AppDeployToolkit.exe Install
Prozess-ID: 33992
PSVersion: 5.1.22621.4391
PSEdition: Desktop
PSCompatibleVersions: 1.0, 2.0, 3.0, 4.0, 5.0, 5.1.22621.4391
BuildVersion: 10.0.22621.4391
CLRVersion: 4.0.30319.42000
WSManStackVersion: 3.0
PSRemotingProtocolVersion: 2.3
SerializationVersion: 1.1.0.1
**********************
**********************
Befehlsstartzeit: 20241220001316
**********************
PS>$env:PSModulePath
C:\WINDOWS\system32\config\systemprofile\Documents\PowerShell\Modules;C:\Program Files\PowerShell\Modules;c:\program files\powershell\7\Modules;C:\Program Files\WindowsPowerShell\Modules;C:\WINDOWS\system32\WindowsPowerShell\v1.0\Modules;C:\Program Files (x86)\Universal\Modules

Second:

**********************
nStart der Windows PowerShell-Aufzeichnung
Startzeit: 20241220001316
Benutzername: WORKGROUP\SYSTEM
RunAs-Benutzer: WORKGROUP\SYSTEM
Konfigurationsname: 
Computer: ************ (Microsoft Windows NT 10.0.22631.0)
Hostanwendung: C:\WINDOWS\system32\WindowsPowerShell\v1.0\PowerShell.exe -ExecutionPolicy Bypass -NoProfile -NoLogo -WindowStyle Hidden -File C:\DEV\Intune\Apps\7-zip\Invoke-AppDeployToolkit.ps1 Install
Prozess-ID: 7016
PSVersion: 5.1.22621.4391
PSEdition: Desktop
PSCompatibleVersions: 1.0, 2.0, 3.0, 4.0, 5.0, 5.1.22621.4391
BuildVersion: 10.0.22621.4391
CLRVersion: 4.0.30319.42000
WSManStackVersion: 3.0
PSRemotingProtocolVersion: 2.3
SerializationVersion: 1.1.0.1
**********************
**********************
Befehlsstartzeit: 20241220001319
**********************
PS>TerminatingError(Import-Module): "Fehler beim Laden der Datendatei des erweiterten Typs: Fehler in den Typdaten "System.Security.AccessControl.ObjectSecurity": Das Element "AuditToString" ist bereits vorhanden.
Fehler in den Typdaten "System.Security.AccessControl.ObjectSecurity": Das Element "AccessToString" ist bereits vorhanden.
Fehler in den Typdaten "System.Security.AccessControl.ObjectSecurity": Das Element "Sddl" ist bereits vorhanden.
Fehler in den Typdaten "System.Security.AccessControl.ObjectSecurity": Das Element "Access" ist bereits vorhanden.
Fehler in den Typdaten "System.Security.AccessControl.ObjectSecurity": Das Element "Group" ist bereits vorhanden.
Fehler in den Typdaten "System.Security.AccessControl.ObjectSecurity": Das Element "Owner" ist bereits vorhanden.
Fehler in den Typdaten "System.Security.AccessControl.ObjectSecurity": Das Element "Path" ist bereits vorhanden.
"
>> TerminatingError(Import-Module): "Der ausgeführte Befehl wurde beendet, da die Einstellungsvariable "ErrorActionPreference" oder ein allgemeiner Parameter auf "Stop" festgelegt ist: Fehler beim Laden der Datendatei des erweiterten Typs: Fehler in den Typdaten "System.Security.AccessControl.ObjectSecurity": Das Element "AuditToString" ist bereits vorhanden.
Fehler in den Typdaten "System.Security.AccessControl.ObjectSecurity": Das Element "AccessToString" ist bereits vorhanden.
Fehler in den Typdaten "System.Security.AccessControl.ObjectSecurity": Das Element "Sddl" ist bereits vorhanden.
Fehler in den Typdaten "System.Security.AccessControl.ObjectSecurity": Das Element "Access" ist bereits vorhanden.
Fehler in den Typdaten "System.Security.AccessControl.ObjectSecurity": Das Element "Group" ist bereits vorhanden.
Fehler in den Typdaten "System.Security.AccessControl.ObjectSecurity": Das Element "Owner" ist bereits vorhanden.
Fehler in den Typdaten "System.Security.AccessControl.ObjectSecurity": Das Element "Path" ist bereits vorhanden.
."
**********************
Befehlsstartzeit: 20241220001319
**********************
PS>TerminatingError(): "Systemfehler"
**********************
Ende der Windows PowerShell-Aufzeichnung
Endzeit: 20241220001319
**********************

For all who want to quickly enable Transcript:

# Define the registry path for transcription settings
$regPath = "HKLM:\Software\Policies\Microsoft\Windows\PowerShell\Transcription"

# Ensure the registry path exists
If (-Not (Test-Path $regPath)) {
    New-Item -Path $regPath -Force | Out-Null
}

# Enable PowerShell transcription
Set-ItemProperty -Path $regPath -Name "EnableTranscripting" -Value 1

# Set the transcription output directory (change the path if needed)
$transcriptDirectory = "C:\PowerShellTranscripts"
If (-Not (Test-Path $transcriptDirectory)) {
    New-Item -Path $transcriptDirectory -ItemType Directory -Force | Out-Null
}
Set-ItemProperty -Path $regPath -Name "OutputDirectory" -Value $transcriptDirectory

# Enable transcription for all users
Set-ItemProperty -Path $regPath -Name "EnableInvocationHeader" -Value 1

Write-Output "System-wide PowerShell transcription has been enabled."
Write-Output "Transcripts will be saved in: $transcriptDirectory"

And Disable the transcript again:

# Define the registry path for transcription settings
$regPath = "HKLM:\Software\Policies\Microsoft\Windows\PowerShell\Transcription"

# Check if the transcription registry path exists
if (Test-Path $regPath) {
    # Disable transcription by removing the registry keys
    Remove-ItemProperty -Path $regPath -Name "EnableTranscripting" -ErrorAction SilentlyContinue
    Remove-ItemProperty -Path $regPath -Name "OutputDirectory" -ErrorAction SilentlyContinue
    Remove-ItemProperty -Path $regPath -Name "EnableInvocationHeader" -ErrorAction SilentlyContinue

    Write-Output "System-wide PowerShell transcription has been disabled."
} else {
    Write-Output "Transcription is not enabled. No changes were made."
}

Your issue is the exact one I was referring to in that bug report. Please download 4.0.4 from GitHub or PSGallery and you should be all good.