Error in AppDeployToolkitMain.ps1


  • See attached error message
  • I have never modified AppDeployToolkitMain.ps1 and all the YouTube tutorials I followed never had me modify it
  • What is even more interesting is that I took a build from one of my co-workers that worked successfully
  • I commented out his code using ## in his Deploy-Application.ps1
  • Then added only like 5-7 lines of code and I receive the error message
  • I went to AppDeployToolkitMain.ps1 to Line Number 3315 and I do not see anything in there that might be the error
  • See below of Line 3315

Any help on resolving this would be great. Thank you.

Also here is the Line 3315 of where the error is triggered. I guess the string value is null or empty? I am confused where it would be empty.

Hi, I think the other forum members may find your explanation a little vague.

  • What PSADT version are you using? N.B. v3.9.3 is the latest and was released on 1st May
  • What Operating System are you deploying to?
  • What version of Powershell are you using?
  • How are you deploying it (Intune / SCCM / other)?
  • Are you deploying it as the logged on user or as System? (Are you using ServiceUI.exe?)

By the folder naming you have, I’m guessing your Deploy-Application.ps1 script may be to deploy a Dell BIOS update? Has Dell changed the deployment method or exit codes in their latest BIOS update executable?
N.B. You may wish to look at using the PS Windows Update to deploy BIOS updates (and Drivers) as this supports Dell hardware (Getting Started with PowerShell and the PSWindowsUpdate Module)

Based on your two comments:

What you have commented out?
What have you added?

As the Deploy-Application.ps1 makes calls to functions from the AppDeployToolkitMain.ps1, is it possible you have commented out something that is core to the function?

1 Like

Thank you for replying back. I am using Version 3.9.3.

I uploaded the version where I am using 3.9.3 go Google Drive.

This version is me building it from scratch.

Here is what I did specifically in this one:

  1. Deploy-Application.ps1
  • You can see all the code I added myself which are all surrounded by:
    ##======================START CUSTOM_0X======================

##======================END CUSTOM_0X======================

  1. AppDeployToolkitConfig.xml
  • I changed Line 27 of the value from True to False
  • Because it was throwing an error when I ran it so I changed this to False

These are the only changes I have done

I am using Version 3.9.3:
PowerShell App Deployment Toolkit 3.9.3

Google Drive Download:

Well, looking at your Deploy-Application.ps1, as Internet Explorer being closed and checking disk space would not be requirements for installing the Dell BIOS update, so I think you would probably need to modify line 185 from:

Show-InstallationWelcome -CloseApps 'iexplore' -AllowDefer -DeferTimes 3 -CheckDiskSpace -PersistPrompt


Show-InstallationWelcome -AllowDefer -DeferTimes 3 -PersistPrompt

But I’d also question if you want your users to be able to defer the install and if so is 3 times too many?
You may also prefer to comment out line 188


As you already have this on line 196

Show-InstallationProgress -StatusMessage "Dell Latitude 7320 Driver Version 1.24.2 will be installed."

Line 218 is your BIOS install command

Execute-Process -Path "C:\Users\simon.lee1\Desktop\PSApp_dell7320_bios_1.24.2_20230317\Toolkit\Files\Latitude_7X20_1.24.2.exe"

I’d suggest you have a read of the Command Line Switches for Dell BIOS Updates, as your installation is likely to need some switches to work when running from a command line (via this script):
In most environments you will need admin priviledges to install a BIOS update, so when Installing from SCCM, Intune or other deployment tools you would specify if it is being installed under the System or Logged on user (If your Windows machines are configured using best security practice most logged on users would not have the necessary admin rights to install software or run certain executables, so in most cases would require to be installed as System)

Personally I would not use the Show-DialogBox function (line 230), but would instead modify the message on line 238, currently:

Show-InstallationPrompt -Message 'You can customize text to appear at the end of an install or remove it completely for unattended installations.' -ButtonRightText 'OK' -Icon Information -NoWait

I think you would benefit from reading the PS App Deploy Toolkit guide (PSAppDeployToolkit.pdf found in the root of your zip file) to get a better understanding of how to use the various functions in the Toolkit

1 Like

Thank you! This is very helpful! I appreciate your time spent on this and reviewing my files! I do appreciate the time. I have other deliverables to work on but I will definitely do a deeper dive on this today or next week. Thank you so much! I will let you know if I have any further questions or if I get it to successfully work as intended.

See the error after I made the changes you suggested in my Deploy-Application.ps1

I also swapped out of the BIOS.exe and used an EXE for video driver. It throws the same error as in the screenshot. Any idea?

Thank you,


The answer is in the screen grab…
What does the message say?
The end of the 1st paragraph in your Error Record screen grab states: “The requested operation requires elevation”
What is the operation it is refering to?
End of the 2nd paragraph in your Error record screen grab states: " <ScriptBlock> C:\Users\simon.lee1\Desktop\PSApp\PSApp_dell7320_bios_1.24.2_20230317\Toolkit\Deploy-Application.ps1: line 219"
So we need to look at line 219 in your Deploy-Application.ps1 script (assuming its the same as your original zip file above):
Execute-Process -Path "C:\Users\simon.lee1\Desktop\PSApp_dell7320_bios_1.24.2_20230317\Toolkit\Files\Latitude_7X20_1.24.2.exe"
The executable “Latitude_7X20_1.24.2.exe” is not running with sufficient rights to run - In my experience BIOS updates need to be run with Administrative priviledges, so you need to execute the script with admin rights

As you hadn’t answered my original questions I’m still uncertain how you are deploying this - these bits of info are useful and would help:

  • What version of Powershell are you using?
  • How are you deploying it (Intune / SCCM / other)?
  • Are you deploying it as the logged on user or as System? (Are you using ServiceUI.exe?)
1 Like