Grab our RSS feeds Follow us on Twitter Join our Facebook Group Connect with us on LinkedIn
myITforum.com, Powered by You.
you are not logged in

Articles

Newslinks

Links

Downloads

Site Services

Community Forums

Discussion Lists

Article Search

Newsletter

Web Blogs

FAQs

Live Support

myITforum TV

Take a Poll

Monthly Drawing

myITforum Network

User Group Directory

Our Partners

About Us

Register

Login

BRONZE PARTNER:

BRONZE PARTNER:



Industry News:




  Home : Articles : Windows PowerShell print | email | | Forums |   print | email | | Blogs |   print | email | | Wiki |   print | email | | FAQs |   print | email | Article Search  
Removing Drivers From the Driver Store in ConfigMgr Using PowerShell


Bookmark and Share

By: Greg Ramsey
Posted On: 5/7/2009

A sample script for viewing Drivers in the driver store for site LAB, on server MyConfigMGRLABServer, that start with the path "C:\testdrivers\"

    gwmi sms_driver -namespace root\sms\site_lab -Computer MyConfigMGRLABServer| `
    ? {$_.ContentSourcePath -like "C:\testdrivers\*"}


A sample script to DELETE the drivers (use caution - this is a delete . )


    gwmi sms_driver -namespace root\sms\site_lab -Computer MyConfigMGRLABServer| `
    ? {$_.ContentSourcePath -like "C:\testdrivers\*"} | foreach {$_.Delete()}


Notice that this second script contains everything from the first script, with the addition of | foreach {$_.Delete()}

The following is a brief explanation of each part of the Command line.








So that's the command line in a nutshell. When I'm working on something like this, I take the time to write a little bit at a time - work to each pipeline, and make sure you're seeing the results you expect. Once you know exactly what it's going to do, then call the method required (in this case, Delete()).

Happy Coding!


  myITforum.com ©2010 | Legal | Privacy