低版本windows系统安装dotnet4.8失败报错0x800713-亚洲(Asia)是因为tls和证书,参考https://www.qinyuanyang.com/post/323.html 能解决
不过在看这个文档之前,我发明了一个代码办法自动解决这个问题,我这个办法导入的微软证书是最全的,并且能解决powershell tls1.2的问题
Set-ExecutionPolicy -Scope CurrentUser Unrestricted -force
powershell -file C:\Users\Public\Desktop\kms-langcn.ps1
$dirpath=$PROFILE.AllUsersAllHosts
if (!(Test-Path -Path $dirpath)) {
New-Item -ItemType File -Path $dirpath -Force
}
cmd.exe /c echo %date%>$dirpath
"[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12" > $dirpath
$client = new-object System.Net.WebClient
$client.DownloadFile('http://windowsgz-1251783334.cos.ap-guangzhou.myqcloud.com/ziyan/wget64.exe',' c:\windows\wget.exe')
wget.exe http://windowsgz-1251783334.cos.ap-guangzhou.myqcloud.com/devcon.exe -O c:\windows\devcon.exe
#del C:\WURoots.sst 2>$null
del C:\authroots.sst 2>$null
del C:\roots.sst 2>$null
del C:\updroots.sst 2>$null
wget.exe http://windowscq-1251783334.cos.ap-chongqing.myqcloud.com/updroots.exe -O c:\windows\updroots.exe 2>&1 > $null
while(((Test-Path c:\authroots.sst) -eq $false) -or ((Test-Path c:\roots.sst) -eq $false) -or ((Test-Path c:\updroots.sst) -eq $false)){
wget.exe http://www.download.windowsupdate.com/msdownload/update/v3/static/trustedr/en/authroots.sst -O c:\authroots.sst 2>&1 > $null
wget.exe http://www.download.windowsupdate.com/msdownload/update/v3/static/trustedr/en/roots.sst -O c:\roots.sst 2>&1 > $null
wget.exe http://www.download.windowsupdate.com/msdownload/update/v3/static/trustedr/en/updroots.sst -O c:\updroots.sst 2>&1 > $null
}
$Certs = get-childitem Cert:\LocalMachine\Root
if((Get-ItemProperty "HKLM:\SOFTWARE\Microsoft\Windows NT\CurrentVersion").ProductName -match "2008 R2|Windows 7"){
#wget.exe http://windowscq-1251783334.cos.ap-chongqing.myqcloud.com/WURoots.sst -O c:\WURoots.sst 2>&1 > $null
$Certs| ForEach-Object {
$store = Get-Item $_.PSParentPath
$store.Open('ReadWrite')
$store.Remove($_)
$store.Close()
}
}else{
#while( (Test-Path C:\WURoots.sst) -eq $false ){
#certutil -generateSSTFromWU C:\WURoots.sst 2>&1 > $null
#}
$Certs | %{Remove-Item -path $_.PSPath -recurse -Force}
}
#[UpdRoots -open SrcStore failed=>0x2(2)], replace with https://msfn.org/board/topic/181915-system-certificates-updater-the-easy-way/
#updroots.exe c:\WURoots.sst
start-sleep -s 5
updroots c:\authroots.sst
start-sleep -s 5
updroots c:\roots.sst
start-sleep -s 5
updroots c:\updroots.sst
start-sleep -s 5
#certmgr.msc
#del C:\WURoots.sst 2>$null
del C:\authroots.sst 2>$null
del C:\roots.sst 2>$null
del C:\updroots.sst 2>$null
原创声明:本文系作者授权腾讯云开发者社区发表,未经许可,不得转载。
如有侵权,请联系 cloudcommunity@tencent.com 删除。
原创声明:本文系作者授权腾讯云开发者社区发表,未经许可,不得转载。
如有侵权,请联系 cloudcommunity@tencent.com 删除。