VirtualBox

source: vbox/trunk/src/VBox/ValidationKit/testdriver/win-vbox-net-drvstore-cleanup.ps1@ 64226

Last change on this file since 64226 was 53624, checked in by vboxsync, 10 years ago

scm automatic cleanups.

  • Property svn:eol-style set to CRLF
  • Property svn:keywords set to Author Date Id Revision
File size: 1.3 KB
Line 
1param([switch]$confirm)
2
3Function AskForConfirmation ($title_text, $message_text, $yes_text, $no_text)
4{
5 if ($confirm) {
6 $title = $title_text
7 $message = $message_text
8
9 $yes = New-Object System.Management.Automation.Host.ChoiceDescription "&Yes", $yes_text
10
11 $no = New-Object System.Management.Automation.Host.ChoiceDescription "&No", $no_text
12
13 $options = [System.Management.Automation.Host.ChoiceDescription[]]($yes, $no)
14
15 $result = $host.ui.PromptForChoice($title, $message, $options, 0)
16 } else {
17 $result = 0
18 }
19
20 return $result
21}
22
23pnputil -e | ForEach-Object { if ($_ -match "Published name :.*(oem\d+\.inf)") {$inf=$matches[1]} elseif ($_ -match "Driver package provider :.*Oracle") {$inf + " " + $_} }
24
25$result = AskForConfirmation "Clean up the driver store" `
26 "Do you want to delete all VirtualBox drivers from the driver store?" `
27 "Deletes all VirtualBox drivers from the driver store." `
28 "No modifications to the driver store will be made."
29
30switch ($result)
31 {
32 0 {pnputil -e | ForEach-Object { if ($_ -match "Published name :.*(oem\d+\.inf)") {$inf=$matches[1]} elseif ($_ -match "Driver package provider :.*Oracle") {$inf} } | ForEach-Object { pnputil -d $inf } }
33 1 {"Removal cancelled."}
34 }
Note: See TracBrowser for help on using the repository browser.

© 2024 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette