显示标签为“Windows”的博文。显示所有博文
显示标签为“Windows”的博文。显示所有博文

2025年5月31日星期六

2025年5月28日星期三

Win11释放IP,重新申请IP

PowerShell: 

 ipconfig /release | Out-Null; Start-Sleep -Seconds 1; ipconfig /renew; ipconfig /all

2025年5月27日星期二

修复Win11无法使用winget的问题

PowerShell 运行winget提示找不到命令,

修复方法:

1  管理员权限PowerShell 执行
Install-Module -Name Microsoft.WinGet.Client -Force
2 管理员权限PowerShell 执行
Repair-WinGetPackageManager

2025年5月25日星期日

Windows 11 一键切换加密DNS (DoH)

最近经常使用公共热点,比如咖啡厅,麦当劳提供的WIFI,无加密,WEB认证。

认证通过后分配的DNS是传统的53端口明文DNS服务器,所以用着就感觉非常不安全,

虽说https能保证了浏览网站的内容是加密的,但是我访问了哪些网站,通过53端口的DNS请求全部暴露了出去,所以每次WEB认证通过,我都要手动在WIN11的界面上,设置手动DNS,1.1.1.1,并且开启DoH,每次都这样点击设置就感觉手太累了,不如写个小工具,一键切换,每次都能省了不少时间。


直接贴脚本内容吧:

首先Set-DNS.ps1



<#

Win11-DoH-Switcher

Copyright (C) 2025 Liu Yu <f78fk@live.com>

This program is free software: you can redistribute it and/or modify

it under the terms of the GNU General Public License as published by

the Free Software Foundation, either version 3 of the License, or

(at your option) any later version.

This program is distributed in the hope that it will be useful,

but WITHOUT ANY WARRANTY; without even the implied warranty of

MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the

GNU General Public License for more details.

#>

# Require admin privileges

if (-NOT ([Security.Principal.WindowsPrincipal][Security.Principal.WindowsIdentity]::GetCurrent()).IsInRole([Security.Principal.WindowsBuiltInRole]::Administrator)) {

Write-Host "This script must be run as Administrator!" -ForegroundColor Red

Start-Sleep 3

exit

}

# Menu

Write-Host "`n=== DNS Configuration Script ===" -ForegroundColor Cyan

Write-Host "1. Set Cloudflare DNS (1.1.1.1) with STRICT DoH (no UDP fallback)"

Write-Host "2. Reset to DHCP automatic DNS"

Write-Host ""

# Get user choice

$choice = Read-Host "Enter option (1 or 2)"

# Configuration

switch ($choice) {

"1" {

# Set Cloudflare DNS

Set-DnsClientServerAddress -InterfaceAlias "WLAN" -ServerAddresses ("1.1.1.1", "1.0.0.1")


# Configure DoH with NO FALLBACK

Set-DnsClientDohServerAddress -ServerAddress "1.1.1.1" `

-DohTemplate "https://cloudflare-dns.com/dns-query{?dns}" `

-AllowFallbackToUdp $false `

-AutoUpgrade $true

Set-DnsClientDohServerAddress -ServerAddress "1.0.0.1" `

-DohTemplate "https://cloudflare-dns.com/dns-query{?dns}" `

-AllowFallbackToUdp $false `

-AutoUpgrade $true

Write-Host "`nSuccess! Configured:" -ForegroundColor Green

Write-Host "- Primary DNS: 1.1.1.1 (DoH enforced)"

Write-Host "- Secondary DNS: 1.0.0.1 (DoH enforced)"

Write-Host "- UDP fallback: DISABLED"

}

"2" {

# Reset to DHCP

Set-DnsClientServerAddress -InterfaceAlias "WLAN" -ResetServerAddresses

Write-Host "`nSuccess! DNS reset to DHCP automatic configuration" -ForegroundColor Green

}

default {

Write-Host "Invalid selection. Please run again and choose 1 or 2." -ForegroundColor Red

Start-Sleep 2

exit

}

}

# Verify configuration

Write-Host "`n=== Current DNS Settings ===" -ForegroundColor Yellow

Get-DnsClientServerAddress -InterfaceAlias "WLAN" | Format-Table -AutoSize

Write-Host "`n=== DoH Configuration ===" -ForegroundColor Yellow

Get-DnsClientDohServerAddress | Format-Table -AutoSize

# Keep window open

Write-Host ""

Read-Host "Press Enter to exit..."



然后是Set-DNS.bat


@REM Win11-DoH-Switcher

@REM Copyright (C) 2025 Liu Yu <f78fk@live.com>

@REM

@REM This program is free software: you can redistribute it and/or modify

@REM it under the terms of the GNU General Public License as published by

@REM the Free Software Foundation, either version 3 of the License, or

@REM (at your option) any later version.

@REM

@REM This program is distributed in the hope that it will be useful,

@REM but WITHOUT ANY WARRANTY; without even the implied warranty of

@REM MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the

@REM GNU General Public License for more details.


@echo off

:: Check admin rights

fltmc >nul 2>&1 && goto :ADMIN


:: Not elevated, create temporary VBS to trigger UAC

echo Requesting administrator privileges...

echo Set UAC = CreateObject("Shell.Application") > "%temp%\RunAsAdmin.vbs"

echo UAC.ShellExecute "%~dpnx0", "", "", "runas", 1 >> "%temp%\RunAsAdmin.vbs"

wscript "%temp%\RunAsAdmin.vbs"

exit /b

:ADMIN

:: Already elevated, run PowerShell script

powershell -ExecutionPolicy Bypass -File "%~dp0Set-DNS.ps1"

pause




两个文件放同一个目录,双击Set-DNS.bat,弹出超级管理员请求,点击是赋予权限,

然后输入1,设置1.1.1.1 DNS, 并且开启DoH,禁止回退到UDP53端口,

设置后ipconfig /all 确认

DNS 服务器 . . . . . . . . . . . : 1.1.1.1

DoH: https://cloudflare-dns.com/dns-query{?dns}

1.0.0.1

DoH: https://cloudflare-dns.com/dns-query{?dns}


成功开启了DoH,这样上网就安心多了。

离开公共WIFI后,因为家里网关已经设置了Doh,不再使用Win11的DoH,所以再次运行脚本

这次输入2,恢复DNS为从DHCP自动获取。


Set-DNS.ps1脚本里的接口使用的是[WLAN]

不同的电脑接口的名字不同,可以通过
netsh interface show interface 
查找WIFI 接口名称

查找出来如果不是[WLAN],就替换[WLAN]为你自己的[接口名称]

github地址:

https://github.com/liuyuf78fk/Win11-DoH-Switcher.git

2025年5月9日星期五

记录一次手动更新英特尔 Management Engine 固件的经历

笔记本电脑是Thinkpad X1c gen11

System Update推送了好几次BIOS和ME,BIOS每次都可以更新成功,ME每次都失败。

表现为安装ME更新包后提示3秒后重启,重启后查看设备管理器的 Intel Management Engine

Interface的固件版本,依然是16.1.25.2124,从联想System Update推送下来的更新包是16.1.35.2557。

无论更新多少次,依旧是16.1.25.2124。


后来研究了下更新包里的脚本,打算手动更新。

1   安装好Intel_R_ME_SW_2512.7.13.0

2    n3xrg03w.exe 运行选择仅解压

3    控制面板\系统和安全\BitLocker 驱动器加密,备份C盘的恢复密钥
(非常重要)

4    暂时关闭BitLocker

       manage-bde -protectors -disable C:  

5    运行 MEInfoWin64.exe ,读取OEM ID 和 Current sku type

C:\DRIVERS\WIN\ME\20250405.11313648\misc\Non_Capsule> .\MEInfoWin64.exe

6    MEInfoWin64.exe读到的信息,重点关注2个字段
      --1  Firmware Update OEM ID  的值记录下来
      --2  Current sku type  的值
            如果是 Consumer 说明(ME 固件为消费级别)
            如果是 Corporate 说明(ME 固件为企业级别)
            消费者版固件:ME_16.0_Cons.BIN
            企业版固件:   ME_16.0_Corp.BIN
            我的机器读取到的是Consumer ,所以需要刷入的固件是 ME_16.0_Cons.BIN

7   运行固件更新命令 

     XXXXXXXX-XXXX-0000-0000-000000000000 替换成刚刚读取到的 OEM ID

FWUpdLcl64.exe -F "C:\DRIVERS\WIN\ME\20250405.11313648\misc\Non_Capsule\ME_16.0_Cons.BIN" -Y -OEMID XXXXXXXX-XXXX-0000-0000-000000000000 

8    更新进度出现了,100%后重启电脑

9    启动界面输入刚刚备份好的恢复密钥解锁驱动器。

10  进系统查看设备管理器的 Intel Management Engine Interface的固件版本号,成功更新为16.1.35.2557。

 

从联想服务器获取到的ME更新程序:

Thinkpad-X1c-Gen11-ME-16.1.35.2557 

 

 

 

 

彩礼是封建产权交易,而非现代契约——基于民事主体平等与代际财务隔离的逻辑推导

 引言 在传统宗法社会与农村习俗中,“彩礼”常被冠以“礼数”、“诚意”或“生育补偿”的修辞。然而,当这些习俗强行嵌入现代社会时,不仅引发了高额债务、代际剥削,更将本应平等的婚姻契约扭曲为一种隐性的财产交易。 如果说“非自愿出生”解构了强加于子女身上的“生恩债”,那么从现代公民法理...