Run PSADT as user without admin prompt

I am trying to run a SCCM package that is script to uninstall a list of printers from a users machine. Unfortunately I am in a bit of a catch 22 and I have ran into my deadline for completing this. In a bit of a pickle and seeing f anyone can assist me.

If I run the script from a blank *.ps1 I run into the set-execution policy restriction. I have tried just running the *.ps1 and also with the following command line:
powershell.exe -executionpolicy Bypass -nologo -noninteractive -file .\YSoftScript.ps1

If I run the script from PSADT with SCCM 2012 package settings to run with user rights I get credential prompts.

Any way to assist me with this?

This is my code:
$Content = Get-Content -Path “$dirFiles\Printers.txt”
$Printers = [IO.File]::ReadAllText("$dirFiles\Printers.txt")

foreach ($Printers in $Content) {
Get-Printer | select name | Where-Object {$_.Name -like “$Printers”} | Remove-Printer
Write-Output “Removed $Printers”
}

If I run this package with admin rights it uninstalls the printers perfectly since my current account has admin rights. If I do it from another machine it doesn’t uninstall anything because it’s running from my credentials not the local user. Thoughts?

Hi,

I believe it is a SCCM problem not a script problem. Do you have an option with SCCM “run with admin rights”?

Thanks,

Agree with Francois. Check your default client settings (In the SCCM Console --> Administration \ Client Settings \ ). Open up the default client settings and the Computer Agent menu. Check the setting “Install permissions”. Sounds like yours might be set to ‘Only administrators’, or perhaps ‘Only administrators and primary users’.