免互動安裝OpenVPN、解除安裝,以及在部署工具中偵測安裝狀態所用的指令。只列出確定可用的指令:來自資訊清單,或是安裝程式技術的官方預設參數。
相關教學: 靜默安裝參數總整理:MSI、NSIS、Inno Setup · 用登錄檔或PowerShell解除安裝程式
使用winget
PowerShell
winget install --id OpenVPNTechnologies.OpenVPN -e --silent --accept-package-agreements --accept-source-agreementswinget upgrade --id OpenVPNTechnologies.OpenVPN -e --silentwinget uninstall --id OpenVPNTechnologies.OpenVPN -e --silent依安裝檔
64位元 · MSI · 所有使用者
靜默安裝
msiexec /i OpenVPN-2.7.7-I001-amd64.msi /qn /norestart寫入記錄檔
msiexec /i OpenVPN-2.7.7-I001-amd64.msi /qn /norestart /l*v "%TEMP%\openvpn-install.log"解除安裝
msiexec /x {94991384-92E2-41D4-B467-B45C47C31CD3} /qn /norestart- MSI產品代碼
- {94991384-92E2-41D4-B467-B45C47C31CD3}
- 解除安裝登錄機碼
- HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\{94991384-92E2-41D4-B467-B45C47C31CD3}
- UpgradeCode
- {461BDF86-D389-4471-BF36-99806B64C127}
- 安裝資料夾
- %ProgramFiles%\OpenVPN
ARM64 · MSI · 所有使用者
靜默安裝
msiexec /i OpenVPN-2.7.7-I001-arm64.msi /qn /norestart寫入記錄檔
msiexec /i OpenVPN-2.7.7-I001-arm64.msi /qn /norestart /l*v "%TEMP%\openvpn-install.log"解除安裝
msiexec /x {94991384-92E2-41D4-B467-B45C47C31CD3} /qn /norestart- MSI產品代碼
- {94991384-92E2-41D4-B467-B45C47C31CD3}
- 解除安裝登錄機碼
- HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\{94991384-92E2-41D4-B467-B45C47C31CD3}
- UpgradeCode
- {1E8C4DDC-9E93-4AE2-9495-DF86821EAA3A}
- 安裝資料夾
- %ProgramFiles%\OpenVPN
32位元 · MSI · 所有使用者
靜默安裝
msiexec /i OpenVPN-2.7.7-I001-x86.msi /qn /norestart寫入記錄檔
msiexec /i OpenVPN-2.7.7-I001-x86.msi /qn /norestart /l*v "%TEMP%\openvpn-install.log"解除安裝
msiexec /x {94991384-92E2-41D4-B467-B45C47C31CD3} /qn /norestart- MSI產品代碼
- {94991384-92E2-41D4-B467-B45C47C31CD3}
- 解除安裝登錄機碼
- HKLM\SOFTWARE\WOW6432Node\Microsoft\Windows\CurrentVersion\Uninstall\{94991384-92E2-41D4-B467-B45C47C31CD3}
- UpgradeCode
- {1195A47B-A37A-4055-9D34-B7A691F7E97B}
- 安裝資料夾
- %ProgramFiles(x86)%\OpenVPN
PowerShell:下載、驗證、安裝
下載官方檔案,驗證SHA256後靜默安裝。
install-openvpn.ps1
$url = 'https://swupdate.openvpn.org/community/releases/OpenVPN-2.7.7-I001-amd64.msi'
$sha256 = '9069A48397C4FD4135FB9C9BAEA4863C74A465651F67E55A423A433E503100BB'
$file = Join-Path $env:TEMP 'OpenVPN-2.7.7-I001-amd64.msi'
Invoke-WebRequest -Uri $url -OutFile $file -UseBasicParsing
if ((Get-FileHash $file -Algorithm SHA256).Hash -ne $sha256) { throw 'SHA256 mismatch' }
Start-Process msiexec.exe -ArgumentList '/i', ('"{0}"' -f $file), '/qn', '/norestart' -Wait install-openvpn.ps1
$url = 'https://swupdate.openvpn.org/community/releases/OpenVPN-2.7.7-I001-arm64.msi'
$sha256 = 'CEFDE0E99E226357109003A3577D1217ED938795B42F4F8BE69E9BE06C23293D'
$file = Join-Path $env:TEMP 'OpenVPN-2.7.7-I001-arm64.msi'
Invoke-WebRequest -Uri $url -OutFile $file -UseBasicParsing
if ((Get-FileHash $file -Algorithm SHA256).Hash -ne $sha256) { throw 'SHA256 mismatch' }
Start-Process msiexec.exe -ArgumentList '/i', ('"{0}"' -f $file), '/qn', '/norestart' -Wait install-openvpn.ps1
$url = 'https://swupdate.openvpn.org/community/releases/OpenVPN-2.7.7-I001-x86.msi'
$sha256 = 'CCB8564AF0817B2A6BE5439A4976B339161B9CEB920AAEBA4E7E67F1F691C2E6'
$file = Join-Path $env:TEMP 'OpenVPN-2.7.7-I001-x86.msi'
Invoke-WebRequest -Uri $url -OutFile $file -UseBasicParsing
if ((Get-FileHash $file -Algorithm SHA256).Hash -ne $sha256) { throw 'SHA256 mismatch' }
Start-Process msiexec.exe -ArgumentList '/i', ('"{0}"' -f $file), '/qn', '/norestart' -Wait