PS Script used to add printer - works manually but not as Win32 app

I am trying to create a script that will install the printer driver for a Ricoh IM9000 MFP. I am trying to make it available to users as a Win32 app in Company Portal.

When I run the install command manually from the source directory, it will work. It shows "Main Building - Ricoh IM9000" in the list of printers. I am able to print to the printer.

When I install the app from Company Portal, the printer does not show up in the list of printers. Only parts of the script seem to have worked. (It will say it installed successfully because of the detection method). If I run the script manually on the device after installing the app from CP, It will give me two errors. It will say that the specified port already exists and that the directory already exists. But it will add the printer to the list of printers in the settings menu. It only works after manually running the script.

I am using the same install command. I tried recreating the .intunewin file with the same results. I have a screenshot of the folder structure below. I specified the source folder as "C:\Users\user\Downloads\PrinterMainBuilding". I specified the installation file as "C:\Users\user\Downloads\PrinterMainBuilding\Source\PrinterMainBuilding.ps1".

Install Command: powershell -ExecutionPolicy Bypass .\PrinterMainBuilding.ps1

Detection Method checks for existence of: "C:\Program Files\MB Printer Detection"

PrinterMainBuilding.ps1 script:

pnputil /add-driver "z03146L18\disk1\MP_7000_.inf"

Add-PrinterDriver -Name "RICOH IM 9000 PCL 6"

Add-PrinterPort -Name "Ricoh IM9000 Main" -PrinterHostAddress 0.0.0.0

Add-Printer -DriverName "RICOH IM 9000 PCL 6" -Name "Main Building - Ricoh IM9000" -PortName "Ricoh IM9000 Main"

New-Item -Path "C:\Program Files" -Name "MB Printer Detection" -ItemType Directory