How To Delete Network Shared Printer As Current User Using PSADT

I have the following code in my PSADT to remove a printer that has been added via a print server. As we use PSADT and deploy via SCCM, it uses a system account and as a result the system account cannot see the network printer in order to delete it. I therefore need to amend the following code so that powershell can run this line of code only as the currently logged on user.

Remove-Printer -Name “\server-address\Label Printer - No10 - 3rd Floor”

I tried the following but to no avail

Execute-ProcessAsUser Remove-Printer -Name “\server-address\Label Printer - No10 - 3rd Floor”


Welcome tro the forum. :wave:t4:

You can run SCCM Applications and SCCM Packages in the context of the currently logged on user. For questions related to PSAppDeployToolkit you may ask your question in their forum

Regardless of that - when you post code or error messages please format it as code using the preformatted text button ( </> ).
Simply place your cursor on an empty line, click the button and paste your code.

Thanks in advance.


thanks for your response.

I dont want the whole package to be run as currently logged on user. I need most of it run by the system account but just need that deletion of printer run as currently logged on user. Any chance you can help me with the PSADT code?

I have posted on the web link you provided however my account has not been activated for some time hence why I have posted on here.

Any assistance is much appreciated.


You could create an extra package or application …

Unfortunately I have never used it … so, no, sorry.

Ah … ok … I’m sorry. You may try it on StackOverflow as well.

1 Like