Я пытаюсь обновить ASP.NET Core с 2.0.3 до 2.1.5 на группе серверов. Я использую сценарий Powershell, который выглядит примерно так:
$software = Get-ChildItem 'HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall'
$software += Get-ChildItem 'HKLM:\SOFTWARE\WOW6432Node\Microsoft\Windows\CurrentVersion\Uninstall\'
$software | Where-Object { $_.GetValue('DisplayName') -like '*.net core*2.0.3*' } | ForEach-Object {
write-verbose "Uninstalling $($_.GetValue('DisplayName'))"
$guid = ([regex]'{[A-Z0-9-]+}').Match($_.Name).Value
$process_params = @{
'FilePath' = Join-Path -Path $env:SystemRoot -ChildPath 'system32' | Join-Path -ChildPath 'msiexec.exe';
'ArgumentList' = @(
"/x$guid",
'/passive',
'/norestart'
);
'Wait' = $True
}
Write-Verbose "Invoking Start-Process with parameters $(ConvertTo-Json $process_params)"
Start-Process @process_params
}
После запуска скрипта ошибок нет, но софт не удаляется. Та же проблема при попытке удалить один элемент с помощью
Start-Process -FilePath 'msiexec' -ArgumentList @('/x{402BF053-9B1B-4962-8784-DA77541C45A3}', '/passive', '/norestart') -Verbose -Wait
Я даже пробовал использовать страшный win32_product
в качестве таких:
(gwmi -Class win32_product -Filter "IdentifyingNumber='{402BF053-9B1B-4962-8784-DA77541C45A3}'").Uninstall()
Ни один из этих вариантов не работает. Добавление /log uninstall.log
к аргументам msiexec дает следующий файл журнала:
=== Logging started: 10/11/2018 9:37:57 ===
Action start 9:37:57: INSTALL.
Action start 9:37:57: FindRelatedProducts.
Action ended 9:37:57: FindRelatedProducts. Return value 0.
Action start 9:37:57: LaunchConditions.
Action ended 9:37:57: LaunchConditions. Return value 1.
Action start 9:37:57: ValidateProductID.
Action ended 9:37:57: ValidateProductID. Return value 1.
Action start 9:37:57: CostInitialize.
Action ended 9:37:57: CostInitialize. Return value 1.
Action start 9:37:57: FileCost.
Action ended 9:37:57: FileCost. Return value 1.
Action start 9:37:57: CostFinalize.
Action ended 9:37:57: CostFinalize. Return value 1.
Action start 9:37:57: MigrateFeatureStates.
Action ended 9:37:57: MigrateFeatureStates. Return value 0.
Action start 9:37:57: InstallValidate.
Action ended 9:37:57: InstallValidate. Return value 1.
Action start 9:37:57: WixDependencyCheck.
If you continue with this uninstall, 1 or more products may stop working properly. Do you want to continue with this uninstall anyway?
CustomAction WixDependencyCheck returned actual error code 259 (note this may not be 100% accurate if translation happened inside sandbox)
Action ended 9:37:57: WixDependencyCheck. Return value 5.
Action ended 9:37:57: INSTALL. Return value 1.
Property(S): UpgradeCode = {9E476537-57D3-4BCD-E354-3F9131F43B15}
Property(S): DOTNETHOME = C:\Program Files (x86)\dotnet\
Property(S): TARGETDIR = C:\
Property(S): WixUIRMOption = UseRM
Property(S): WIXUI_INSTALLDIR = DOTNETHOME
Property(S): ALLUSERS = 1
Property(S): ARPNOMODIFY = 1
Property(S): ProgramFilesFolder = C:\Program Files (x86)\
Property(S): ProductCPU = x86
Property(S): RTM_ProductVersion = 16.12.25816
Property(S): MSIFASTINSTALL = 7
Property(S): Manufacturer = Microsoft Corporation
Property(S): ProductCode = {402BF053-9B1B-4962-8784-DA77541C45A3}
Property(S): ProductLanguage = 1033
Property(S): ProductName = Microsoft .NET Core Host - 2.0.3 (x86)
Property(S): ProductVersion = 16.12.25816
Property(S): DefaultUIFont = WixUI_Font_Normal
Property(S): WixUI_Mode = InstallDir
Property(S): ErrorDialog = ErrorDlg
Property(S): SecureCustomProperties = IGNOREDEPENDENCIES;WIX_DOWNGRADE_DETECTED;WIX_UPGRADE_DETECTED
Property(S): MsiLogFileLocation = C:\Windows\system32\uninstall.log
Property(S): PackageCode = {D490295B-DB46-41F3-BF1B-ED9A8E55B81B}
Property(S): ProductState = 5
Property(S): ProductToBeRegistered = 1
Property(S): REBOOTPROMPT = S
Property(S): REBOOT = ReallySuppress
Property(S): REMOVE = ALL
Property(S): CURRENTDIRECTORY = C:\Windows\system32
Property(S): CLIENTUILEVEL = 2
Property(S): CLIENTPROCESSID = 13344
Property(S): MsiSystemRebootPending = 1
Property(S): PRODUCTLANGUAGE = 1033
Property(S): VersionDatabase = 200
Property(S): VersionMsi = 5.00
Property(S): VersionNT = 603
Property(S): VersionNT64 = 603
Property(S): WindowsBuild = 9600
Property(S): ServicePackLevel = 0
Property(S): ServicePackLevelMinor = 0
Property(S): MsiNTProductType = 3
Property(S): WindowsFolder = C:\Windows\
Property(S): WindowsVolume = C:\
Property(S): System64Folder = C:\Windows\system32\
Property(S): SystemFolder = C:\Windows\SysWOW64\
Property(S): RemoteAdminTS = 1
Property(S): TempFolder = C:\Users\username_redacted\AppData\Local\Temp\
Property(S): CommonFilesFolder = C:\Program Files (x86)\Common Files\
Property(S): ProgramFiles64Folder = C:\Program Files\
Property(S): CommonFiles64Folder = C:\Program Files\Common Files\
Property(S): AppDataFolder = C:\Users\username_redacted\AppData\Roaming\
Property(S): FavoritesFolder = C:\Users\username_redacted\Favorites\
Property(S): NetHoodFolder = C:\Users\username_redacted\AppData\Roaming\Microsoft\Windows\Network Shortcuts\
Property(S): PersonalFolder = C:\Users\username_redacted\Documents\
Property(S): PrintHoodFolder = C:\Users\username_redacted\AppData\Roaming\Microsoft\Windows\Printer Shortcuts\
Property(S): RecentFolder = C:\Users\username_redacted\AppData\Roaming\Microsoft\Windows\Recent\
Property(S): SendToFolder = C:\Users\username_redacted\AppData\Roaming\Microsoft\Windows\SendTo\
Property(S): TemplateFolder = C:\ProgramData\Microsoft\Windows\Templates\
Property(S): CommonAppDataFolder = C:\ProgramData\
Property(S): LocalAppDataFolder = C:\Users\username_redacted\AppData\Local\
Property(S): MyPicturesFolder = C:\Users\username_redacted\Pictures\
Property(S): AdminToolsFolder = C:\ProgramData\Microsoft\Windows\Start Menu\Programs\Administrative Tools\
Property(S): StartupFolder = C:\ProgramData\Microsoft\Windows\Start Menu\Programs\Startup\
Property(S): ProgramMenuFolder = C:\ProgramData\Microsoft\Windows\Start Menu\Programs\
Property(S): StartMenuFolder = C:\ProgramData\Microsoft\Windows\Start Menu\
Property(S): DesktopFolder = C:\Users\Public\Desktop\
Property(S): FontsFolder = C:\Windows\Fonts\
Property(S): GPTSupport = 1
Property(S): OLEAdvtSupport = 1
Property(S): ShellAdvtSupport = 1
Property(S): MsiAMD64 = 21
Property(S): Msix64 = 21
Property(S): Intel = 21
Property(S): PhysicalMemory = 10477
Property(S): VirtualMemory = 10819
Property(S): AdminUser = 1
Property(S): MsiTrueAdminUser = 1
Property(S): LogonUser = username_redacted
Property(S): UserSID = S-1-5-21-3813976000-3187682355-4120183401-9416
Property(S): UserLanguageID = 1033
Property(S): ComputerName = VMTEST08
Property(S): SystemLanguageID = 1033
Property(S): ScreenX = 1024
Property(S): ScreenY = 768
Property(S): CaptionHeight = 23
Property(S): BorderTop = 1
Property(S): BorderSide = 1
Property(S): TextHeight = 16
Property(S): TextInternalLeading = 3
Property(S): ColorBits = 32
Property(S): TTCSupport = 1
Property(S): Time = 9:37:57
Property(S): Date = 10/11/2018
Property(S): MsiNetAssemblySupport = 4.7.3062.0
Property(S): MsiWin32AssemblySupport = 6.3.9600.17415
Property(S): RedirectedDllSupport = 2
Property(S): MsiRunningElevated = 1
Property(S): Privileged = 1
Property(S): Installed = 00:00:00
Property(S): DATABASE = C:\Windows\Installer\40b0b.msi
Property(S): UILevel = 3
Property(S): OriginalDatabase = C:\Windows\Installer\40b0b.msi
Property(S): MsiUIProgressOnly = 1
Property(S): MsiUIHideCancel = 1
Property(S): Preselected = 1
Property(S): ACTION = INSTALL
Property(S): ROOTDRIVE = C:\
Property(S): CostingComplete = 1
Property(S): OutOfDiskSpace = 0
Property(S): OutOfNoRbDiskSpace = 0
Property(S): PrimaryVolumeSpaceAvailable = 0
Property(S): PrimaryVolumeSpaceRequired = 0
Property(S): PrimaryVolumeSpaceRemaining = 0
Property(S): INSTALLLEVEL = 1
MSI (s) (7C:C0) [09:37:57:357]: Product: Microsoft .NET Core Host - 2.0.3 (x86) -- Removal completed successfully.
MSI (s) (7C:C0) [09:37:57:357]: Windows Installer removed the product. Product Name: Microsoft .NET Core Host - 2.0.3 (x86). Product Version: 16.12.25816. Product Language: 1033. Manufacturer: Microsoft Corporation. Removal success or error status: 0.
=== Logging stopped: 10/11/2018 9:37:57 ===
Как видите, даже файл журнала свидетельствует об успехе - но продукт все равно присутствует каждый раз! Было бы здорово помочь с этой конкретной проблемой, но я также был бы признателен за любое общее устранение неполадок установщика Windows, так как я не нашел много документации в Интернете. Спасибо за уделенное время.
Я столкнулся с той же проблемой (используя шоколад для удаления) и остановился на этом решении. (Не забудьте изменить переменную $ version, чтобы она соответствовала версии, которую вы хотите удалить)
$version = '2.2.6'
$softwareName = '.Net Core'
$searchString = "*$softwareName*$version*"
$msiExecPath = Join-Path -Path $env:SystemRoot -ChildPath 'system32' | Join-Path -ChildPath 'msiexec.exe'
function Find-DotNetCoreInstall {
param (
$ver = $version,
$softName = $softwareName
)
$software = @(
'HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\*',
'HKLM:\SOFTWARE\WOW6432Node\Microsoft\Windows\CurrentVersion\Uninstall\*'
)
$searchString = "*$softwareName*$version*"
$allDotNetItems = Get-ItemProperty $software | Where-Object {$_.displayName -like $searchString} | Select-Object DisplayName,DisplayVersion,UninstallString
Write-Output $allDotNetItems
}
$allDotNetItems = Find-DotNetCoreInstall
if($allDotNetItems.count -gt 0) {
Write-Host "Uninstalling $($allDotNetItems.count) components for $softwareName $version"
foreach($item in $allDotNetItems) {
$uninstallString = $item.UninstallString
$name = $item.DisplayName
if ($uninstallString -like "MsiExec.exe *") {
Write-Host "Uninstalling $name version: $($item.displayVersion)"
$guid = ([regex]'{[A-Z0-9-]+}').Match($uninstallString).Value
start-process -FilePath $msiExecPath -ArgumentList @("/x$guid", "/passive", "/quiet", "/norestart", "IGNOREDEPENDENCIES=ALL", "/log `"$env:temp\$($name)_Uninstall_$($version).log`"") -Wait
}
else {
$filepath = ($uninstallString.Split('/')[0]).replace('"','')
Write-Host "Uninstalling $name version: $($item.displayVersion)"
Start-Process -FilePath $filepath -ArgumentList @("/uninstall", "/silent") -Wait
}
}
}
else {
Write-Host "There are no installed components of $software $version"
exit 0
}
$finalCheck = Find-DotNetCoreInstall
if ($finalCheck.count -eq 0){
Write-Host "All .NET components have been uninstalled"
exit 0
}
else {
Write-Host "Error: NOT ALL COMPONENTS uninstalled! `n $finalCheck "
exit 1
}
В журналах вы можете увидеть, как WixDependencyCheck находит другие MSI-файлы, которые зависят от этого, и выдает ошибки.
Добавление параметра IGNOREDEPENDENCIES=ALL
в msiexec следует это исправить.