VirtualBox

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

最後變更 在這個檔案從64498是 53624,由 vboxsync 提交於 10 年 前

scm automatic cleanups.

  • 屬性 svn:eol-style 設為 CRLF
  • 屬性 svn:keywords 設為 Author Date Id Revision
檔案大小: 1.3 KB
 
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 }
注意: 瀏覽 TracBrowser 來幫助您使用儲存庫瀏覽器

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