Quantcast
Viewing all articles
Browse latest Browse all 4762

Deploying PowerShell Command Line via SCCM

Hi IT Professonals,

I am attempting to deploy a PowerShell script that removes all but the built-in XPS, Fax and OneNote Windows 7 printers.

I currently work in a 2012 R2 Domain Level, Windows 7 environment.

I am attempting to create a deployment package within SCCM that runs the following PowerShell script:

# Get Printers
$printers = Get-WmiObject -Class Win32_Printer

# Delete Printers
$printers | ForEach-Object {
    if ($_.Name -like "*XPS*" -Or $_.Name -like "*Fax*" -Or $_.Name -like "*OneNote*")
    {
    }
    else
    {
        $_.Delete()
    }
}

I guess this could be converted into a general question in regards to how to deploy a .ps1 script via SCCM, but I have managed to Create a program within SCCM that runs: powershell.exe -ExecutionPolicy Bypass -File .\RemoveAllPrinters

And I have ensured that the Startup folder points to the UNC path to the directory where this PowerShell script is housed

The script runs as the current user permissions, and receives error -196608

Is this the right way to go?

Thank you in advance,

Daniel


Daniel Scoland Windows 7 Professional SharePoint 2010 Microsoft Office 2010


Viewing all articles
Browse latest Browse all 4762

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>