Here is script to delete drivers<p>I was having problems with corrupt drivers and decided to remove my NIC drivers and re-add them.  When I went to delete them I realized with over 100 drivers to delete you have to delete them one by one.  This can become a major pain and luckily on this forum there was someone who graciously provided a script that would remove ALL drivers from sccm.  With that being said I didn't want to delete over 1000 drivers and re-add all of them, I only wanted a select few.   To help others out there that aren't as script oriented I wanted to share my script that will go through and delete disabled drivers.  You can select multiple drivers and just click disable, then run this script and it will clear them out for you.  It worked quite nicely for me, and I hope it helps the next person!</p> <p> </p> <p align=left> </p> <p align=left> </p> <p align=left> <div class=codeseg> <div class=codecontent> <div class=codesniptitle><span style="width:100%">Code Snippet</span></div> <p align=left>' Connect to the SMS namespace</p> <p align=left>siteNamespace = GetSiteNamespace()</p> <p align=left> </p> <p align=left>SET objWMIService = GetObject( &quot;winmgmts:{impersonationLevel=impersonate}!&quot;_<br>                               &amp;siteNamespace)</p> <p align=left> </p> <p align=left>SET drivers = objWMIService.ExecQuery(&quot;SELECT * From SMS_Driver&quot;)</p> <p align=left> </p> <p align=left>numDriversDeleted = 0</p> <p align=left> </p> <p align=left>' Process the results</p> <p align=left>FOR EACH driver in drivers</p> <p align=left>IF driver.IsEnabled = 0 THEN<br> driver.Delete_<br> numDriversDeleted = numDriversDeleted +1<br>END IF</p> <p align=left>NEXT</p> <p align=left> </p> <p align=left>WScript.Echo &quot;Successfully deleted &quot;&amp;numDriversDeleted&amp;&quot; drivers.&quot; </p> <p align=left><br> </p> <p align=left>'</p> <p align=left>' Utility function to search for the site namespace</p> <p align=left>'</p> <p align=left>FUNCTION GetSiteNamespace()</p> <p align=left>    ' Find SMS Provider</p> <p align=left>    SET objSMSNamespace = GetObject(&quot;winmgmts:{impersonationLevel=&quot;&amp;_<br>                                    &quot;impersonate}!\\.\root\sms&quot;)</p> <p align=left>    SET results = objSMSNamespace.ExecQuery(&quot;SELECT * From &quot;&amp;_<br>        &quot;SMS_ProviderLocation WHERE ProviderForLocalSite = true&quot;)</p> <p align=left> </p> <p align=left>    ' Process the results</p> <p align=left>    FOR EACH r in results    </p> <p align=left>        namespacePath = r.NamespacePath</p> <p align=left>    NEXT</p> <p align=left> </p> <p align=left>    ' Fail if we did not find the site</p> <p align=left>    IF namespacePath = &quot;&quot; THEN</p> <p align=left>        WScript.Echo &quot;Failed to locate SMS provider.&quot;</p> <p align=left>        WScript.Quit 1</p> <p align=left>    END IF</p> <p align=left>    </p> <p align=left>    ' Return</p> <p align=left>    GetSiteNamespace = namespacePath</p> <p align=left>END FUNCTION</p> <p align=left> </p></div></div> <p align=left> </p> <p></p> <p align=left><br></p>© 2009 Microsoft Corporation. All rights reserved.Fri, 26 Jun 2009 15:08:28 Zf5947dd3-d3ef-4e2c-b6af-8b6bb74546cdhttp://social.technet.microsoft.com/Forums/en-US/configmgradminconsole/thread/f5947dd3-d3ef-4e2c-b6af-8b6bb74546cd#f5947dd3-d3ef-4e2c-b6af-8b6bb74546cdhttp://social.technet.microsoft.com/Forums/en-US/configmgradminconsole/thread/f5947dd3-d3ef-4e2c-b6af-8b6bb74546cd#f5947dd3-d3ef-4e2c-b6af-8b6bb74546cdShawn Nelsonhttp://social.technet.microsoft.com/Profile/en-US/?user=Shawn%20NelsonHere is script to delete drivers<p>I was having problems with corrupt drivers and decided to remove my NIC drivers and re-add them.  When I went to delete them I realized with over 100 drivers to delete you have to delete them one by one.  This can become a major pain and luckily on this forum there was someone who graciously provided a script that would remove ALL drivers from sccm.  With that being said I didn't want to delete over 1000 drivers and re-add all of them, I only wanted a select few.   To help others out there that aren't as script oriented I wanted to share my script that will go through and delete disabled drivers.  You can select multiple drivers and just click disable, then run this script and it will clear them out for you.  It worked quite nicely for me, and I hope it helps the next person!</p> <p> </p> <p align=left> </p> <p align=left> </p> <p align=left> <div class=codeseg> <div class=codecontent> <div class=codesniptitle><span style="width:100%">Code Snippet</span></div> <p align=left>' Connect to the SMS namespace</p> <p align=left>siteNamespace = GetSiteNamespace()</p> <p align=left> </p> <p align=left>SET objWMIService = GetObject( &quot;winmgmts:{impersonationLevel=impersonate}!&quot;_<br>                               &amp;siteNamespace)</p> <p align=left> </p> <p align=left>SET drivers = objWMIService.ExecQuery(&quot;SELECT * From SMS_Driver&quot;)</p> <p align=left> </p> <p align=left>numDriversDeleted = 0</p> <p align=left> </p> <p align=left>' Process the results</p> <p align=left>FOR EACH driver in drivers</p> <p align=left>IF driver.IsEnabled = 0 THEN<br> driver.Delete_<br> numDriversDeleted = numDriversDeleted +1<br>END IF</p> <p align=left>NEXT</p> <p align=left> </p> <p align=left>WScript.Echo &quot;Successfully deleted &quot;&amp;numDriversDeleted&amp;&quot; drivers.&quot; </p> <p align=left><br> </p> <p align=left>'</p> <p align=left>' Utility function to search for the site namespace</p> <p align=left>'</p> <p align=left>FUNCTION GetSiteNamespace()</p> <p align=left>    ' Find SMS Provider</p> <p align=left>    SET objSMSNamespace = GetObject(&quot;winmgmts:{impersonationLevel=&quot;&amp;_<br>                                    &quot;impersonate}!\\.\root\sms&quot;)</p> <p align=left>    SET results = objSMSNamespace.ExecQuery(&quot;SELECT * From &quot;&amp;_<br>        &quot;SMS_ProviderLocation WHERE ProviderForLocalSite = true&quot;)</p> <p align=left> </p> <p align=left>    ' Process the results</p> <p align=left>    FOR EACH r in results    </p> <p align=left>        namespacePath = r.NamespacePath</p> <p align=left>    NEXT</p> <p align=left> </p> <p align=left>    ' Fail if we did not find the site</p> <p align=left>    IF namespacePath = &quot;&quot; THEN</p> <p align=left>        WScript.Echo &quot;Failed to locate SMS provider.&quot;</p> <p align=left>        WScript.Quit 1</p> <p align=left>    END IF</p> <p align=left>    </p> <p align=left>    ' Return</p> <p align=left>    GetSiteNamespace = namespacePath</p> <p align=left>END FUNCTION</p> <p align=left> </p></div></div> <p align=left> </p> <p></p> <p align=left><br></p>Wed, 22 Oct 2008 16:34:29 Z2008-10-22T16:34:29Zhttp://social.technet.microsoft.com/Forums/en-US/configmgradminconsole/thread/f5947dd3-d3ef-4e2c-b6af-8b6bb74546cd#a3ddeb50-2f92-4f9a-ae3b-6c3386c56178http://social.technet.microsoft.com/Forums/en-US/configmgradminconsole/thread/f5947dd3-d3ef-4e2c-b6af-8b6bb74546cd#a3ddeb50-2f92-4f9a-ae3b-6c3386c56178chiners_68http://social.technet.microsoft.com/Profile/en-US/?user=chiners_68Here is script to delete drivers<p>Note :- Do not run on workstation with SCCM Admin console you will just get errors.</p> <p align=left> </p> <p align=left>I run this on my primary site server &amp; although it used nearly 100% CPU after about 5 mins it reprted it &quot;Deleted xxx drivers succesfully&quot; &amp; CPU then restored to normal.</p> <p align=left> </p> <p align=left><font face=Arial size=2></font> </p>Fri, 14 Nov 2008 10:52:21 Z2008-11-14T10:52:21Zhttp://social.technet.microsoft.com/Forums/en-US/configmgradminconsole/thread/f5947dd3-d3ef-4e2c-b6af-8b6bb74546cd#df86d179-ed1f-41a8-a41f-85e429ff2efehttp://social.technet.microsoft.com/Forums/en-US/configmgradminconsole/thread/f5947dd3-d3ef-4e2c-b6af-8b6bb74546cd#df86d179-ed1f-41a8-a41f-85e429ff2efepcgeek86http://social.technet.microsoft.com/Profile/en-US/?user=pcgeek86Here is script to delete drivers<font size=2><span style="font-family:Arial">Just an idea ... you could simplify your code by changing your query to: <span style="color:rgb(0,0,128)">select * from sms_driver where IsEnabled = '0' <span style="color:rgb(0,0,0)">and then avoid having to use the If .. Then </span></span>statement to determine the criteria to delete.<br><br><span style="font-weight:bold">Trevor Sullivan</span><br><span style="font-style:italic">Systems Engineer</span><br></span></font>Wed, 19 Nov 2008 22:11:49 Z2008-11-19T22:11:49Zhttp://social.technet.microsoft.com/Forums/en-US/configmgradminconsole/thread/f5947dd3-d3ef-4e2c-b6af-8b6bb74546cd#c02fd006-d58e-40d4-b600-33909b56b4adhttp://social.technet.microsoft.com/Forums/en-US/configmgradminconsole/thread/f5947dd3-d3ef-4e2c-b6af-8b6bb74546cd#c02fd006-d58e-40d4-b600-33909b56b4adDewNuthttp://social.technet.microsoft.com/Profile/en-US/?user=DewNutHere is script to delete driversworked for me.  thanks for the script.  saved me an hour. <p align=left><font face=Arial size=2></font> </p>Tue, 09 Dec 2008 16:31:24 Z2008-12-09T16:31:24Zhttp://social.technet.microsoft.com/Forums/en-US/configmgradminconsole/thread/f5947dd3-d3ef-4e2c-b6af-8b6bb74546cd#453f0413-bd16-4aa9-9b1b-e88b346e5ef7http://social.technet.microsoft.com/Forums/en-US/configmgradminconsole/thread/f5947dd3-d3ef-4e2c-b6af-8b6bb74546cd#453f0413-bd16-4aa9-9b1b-e88b346e5ef7aacajohttp://social.technet.microsoft.com/Profile/en-US/?user=aacajoHere is script to delete driversDidn't work for me.<br/><br/>SwbemObjectEx: Generic Failure<br/><br/>Looks like it is complaining about this line:<br/><br/>driver.delete_<br/><br/>Any ideas?Wed, 27 May 2009 21:11:27 Z2009-05-27T21:11:27Zhttp://social.technet.microsoft.com/Forums/en-US/configmgradminconsole/thread/f5947dd3-d3ef-4e2c-b6af-8b6bb74546cd#28365a9c-8c02-454d-a683-374672db2258http://social.technet.microsoft.com/Forums/en-US/configmgradminconsole/thread/f5947dd3-d3ef-4e2c-b6af-8b6bb74546cd#28365a9c-8c02-454d-a683-374672db2258pcgeek86http://social.technet.microsoft.com/Profile/en-US/?user=pcgeek86Here is script to delete driversaacajo,<br/><br/>You'd have to provide a little more specific information about the error. What is the message you're getting? Can you post a screenshot on tinypic.com or something?<br/><br/><strong>Trevor Sullivan</strong><br/><em>Systems Engineer<br/></em>OfficeMax Corporation<hr class="sig">Trevor Sullivan Systems Engineer OfficeMax CorporationFri, 05 Jun 2009 12:43:10 Z2009-06-05T12:43:10Zhttp://social.technet.microsoft.com/Forums/en-US/configmgradminconsole/thread/f5947dd3-d3ef-4e2c-b6af-8b6bb74546cd#631744ce-3ca0-4087-9d1c-005ddf245255http://social.technet.microsoft.com/Forums/en-US/configmgradminconsole/thread/f5947dd3-d3ef-4e2c-b6af-8b6bb74546cd#631744ce-3ca0-4087-9d1c-005ddf245255eobionthttp://social.technet.microsoft.com/Profile/en-US/?user=eobiontHere is script to delete driversMe too.  I saw this script elsewhere and thought it was not working.  I added a wscript.echo driver.localizedDriverName in the for loop and then saw that it was just taking 20-30 seconds per driver deletion to run on my system.  so 90 driver deletions is going to take 40 minutes.  Maybe not faster than by hand, but certainly easier. Fri, 26 Jun 2009 15:05:44 Z2009-06-26T15:05:44Zhttp://social.technet.microsoft.com/Forums/en-US/configmgradminconsole/thread/f5947dd3-d3ef-4e2c-b6af-8b6bb74546cd#622e88b1-8f2f-42bb-b2b7-7880ac14ba95http://social.technet.microsoft.com/Forums/en-US/configmgradminconsole/thread/f5947dd3-d3ef-4e2c-b6af-8b6bb74546cd#622e88b1-8f2f-42bb-b2b7-7880ac14ba95pcgeek86http://social.technet.microsoft.com/Profile/en-US/?user=pcgeek86Here is script to delete driverseobiont,<br/><br/>That seems like an abnormally long time to delete each driver. I'm pretty sure mine delete within a few seconds, each.<br/><br/><strong>Trevor Sullivan<br/></strong><em>Systems Engineer<br/></em>OfficeMax Corporation<hr class="sig">Trevor Sullivan Systems Engineer OfficeMax CorporationFri, 26 Jun 2009 15:08:28 Z2009-06-26T15:08:28Z