BRONZE PARTNER:
BRONZE PARTNER:
Industry News:

| |
| |
 |
 |
 |
 |
 |
| Removing Drivers From the Driver Store in ConfigMgr Using PowerShell |
 |
|
|
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!
|
 |
 |
 |
|
|