{"id":135,"date":"2025-01-15T14:49:54","date_gmt":"2025-01-15T06:49:54","guid":{"rendered":"https:\/\/blog.hcha.site\/?p=135"},"modified":"2026-03-07T14:12:04","modified_gmt":"2026-03-07T06:12:04","slug":"mas-%e6%bf%80%e6%b4%bbwindows-office-%e4%bd%bf%e7%94%a8%e5%92%8c%e5%8e%9f%e7%90%86%e8%a7%a3%e6%9e%90","status":"publish","type":"post","link":"https:\/\/blog.hcha.site\/?p=135","title":{"rendered":"MAS: \u6fc0\u6d3bWindows &amp; Office \u4f7f\u7528\u548c\u539f\u7406\u89e3\u6790"},"content":{"rendered":"\n<h2 class=\"wp-block-heading\">tl;dr<\/h2>\n\n\n\n<p>\u5728 Powershell \u4e2d\u8fd0\u884c\u4ee5\u4e0b\u6307\u4ee4\uff1a<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>irm https:\/\/get.activated.win | iex<\/code><\/pre>\n\n\n\n<p>\u8fd9\u6761\u547d\u4ee4\u4f1a\u6267\u884c\u5728<a href=\"https:\/\/get.activated.win\" target=\"_blank\" rel=\"noreferrer noopener\">https:\/\/get.activated.win<\/a>\u4e0a\u7684\u811a\u672c\u5185\u5bb9\u3002<\/p>\n\n\n\n<p>\u8fdc\u7a0b\u6267\u884c\u811a\u672c\u4f1a\u5f15\u5165\u53ef\u80fd\u7684\u5a01\u80c1\u9762\uff0c\u5f3a\u70c8\u5efa\u8bae\u5b8c\u6574\u5ba1\u67e5\u811a\u672c\u5185\u5bb9\u540e\u518d\u6267\u884c\u3002<\/p>\n\n\n\n<p>\u4ee3\u7801\u5f00\u6e90\u5728 Github: <a href=\"https:\/\/github.com\/massgravel\/Microsoft-Activation-Scripts\">massgravel\/Microsoft-Activation-Scripts<\/a><\/p>\n\n\n\n<h2 class=\"wp-block-heading\">\u547d\u4ee4\u89e3\u6790<\/h2>\n\n\n\n<p><code>irm<\/code>\u662f<code>Invoke-RestMethod<\/code>\u5728 Powershell \u4e2d\u7684\u522b\u540d\uff0c\u7528\u4e8e\u5411\u8fdc\u7a0b\u670d\u52a1\u5668\u53d1\u9001\u4e00\u4e2a HTTP \u8bf7\u6c42\uff0c\u5e76\u5c06\u83b7\u53d6\u7684\u5185\u5bb9\u4f20\u9012\u7ed9Powershell\u3002<\/p>\n\n\n\n<p>\u5728\u8fd9\u6761\u547d\u4ee4\u4e2d\uff0c<code>irm<\/code>\u5411<a href=\"https:\/\/get.activated.win\" target=\"_blank\" rel=\"noreferrer noopener\">https:\/\/get.activated.win<\/a>\u53d1\u9001\u4e86\u4e00\u4e2a HTTP GET \u8bf7\u6c42\uff0c\u8fd9\u4e2a\u7f51\u5740\u4f1a\u8fd4\u56de\u4e00\u4e2a\u6fc0\u6d3b\u811a\u672c\u7684\u5185\u5bb9\uff0c\u5e76\u901a\u8fc7\u7ba1\u9053\u7b26\u53f7&#8221;|&#8221;\u4f20\u9012\u7ed9\u4e0b\u4e00\u9879\uff0c\u5373<code>iex<\/code>\u3002<\/p>\n\n\n\n<p><code>iex<\/code>\u662f<code>Invoke-Expression<\/code>\u5728 Powershell \u4e2d\u7684\u522b\u540d\uff0c\u7528\u4e8e\u6267\u884c\u4f5c\u4e3a\u5b57\u7b26\u4e32\u8f93\u5165\u7684 Powershell \u811a\u672c\u6216\u8005\u547d\u4ee4\u3002<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">\u4f7f\u7528<\/h2>\n\n\n\n<p>\u6309\u4e0b<code>Win+R<\/code>\u5feb\u6377\u952e\uff0c\u8f93\u5165&#8221;Powershell&#8221;\u540e\u56de\u8f66\u3002<\/p>\n\n\n\n<p>\u5728\u5f39\u51fa\u7684\u547d\u4ee4\u63d0\u793a\u7b26\u4e2d\uff0c\u8f93\u5165\uff1a<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>irm https:\/\/get.activated.win | iex<\/code><\/pre>\n\n\n\n<p>\u7136\u540e\u56de\u8f66\u6267\u884c\u3002<\/p>\n\n\n\n<p>\u7a0d\u7b49\u7247\u523b\uff0c\u5982\u679c\u51fa\u73b0\u4e86 UAC \u5f39\u7a97\uff0c\u70b9\u51fb&#8221;\u662f&#8221;\u3002<\/p>\n\n\n\n<p>\u5982\u679c\u4e00\u5207\u987a\u5229\uff0c\u4f60\u4f1a\u770b\u5230\u4e00\u4e2a\u7c7b\u4f3c\u4ee5\u4e0b\u7684\u7a97\u53e3\uff1a<\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><div class='fancybox-wrapper lazyload-container-unload' data-fancybox='post-images' href='https:\/\/img.hcha.site\/images\/original\/landscape\/20250412_161916_6074.png'><img class=\"lazyload lazyload-style-1\" src=\"data:image\/svg+xml;base64,PCEtLUFyZ29uTG9hZGluZy0tPgo8c3ZnIHdpZHRoPSIxIiBoZWlnaHQ9IjEiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyIgc3Ryb2tlPSIjZmZmZmZmMDAiPjxnPjwvZz4KPC9zdmc+\"  decoding=\"async\" data-original=\"https:\/\/img.hcha.site\/images\/original\/landscape\/20250412_161916_6074.png\" src=\"data:image\/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAAAAJcEhZcwAADsQAAA7EAZUrDhsAAAANSURBVBhXYzh8+PB\/AAffA0nNPuCLAAAAAElFTkSuQmCC\" alt=\"\"\/><\/div><\/figure>\n\n\n\n<p>\u4f60\u53ef\u4ee5\u9009\u62e9\u9002\u5408\u4f60\u7684\u6fc0\u6d3b\u65b9\u5f0f\uff0c\u4f7f\u7528\u952e\u76d8\u9009\u62e9\uff1a<\/p>\n\n\n\n<p>\u5982\u679c\u6309\u4e0b\u952e\u76d8&#8221;1&#8243;\uff0c\u5c06\u4f1a\u4f7f\u7528\u6570\u5b57\u8bb8\u53ef\u8bc1\u65b9\u5f0f\u6c38\u4e45\u6fc0\u6d3b Windows\uff0c\u8fd9\u79cd\u65b9\u6cd5\u9700\u8981\u8054\u7f51\u3002<\/p>\n\n\n\n<p>\u5982\u679c\u6309\u4e0b\u952e\u76d8&#8221;2&#8243;\uff0c\u5c06\u4f1a\u901a\u8fc7\u4fee\u6539\u4e00\u4e2adll\u6587\u4ef6\u7684\u65b9\u5f0f\u6765\u6c38\u4e45\u6fc0\u6d3b Office\uff0c\u8fd9\u79cd\u65b9\u6cd5\u4e0d\u9700\u8981\u8054\u7f51\u3002<\/p>\n\n\n\n<p>\u5982\u679c\u6309\u4e0b\u952e\u76d8&#8221;3&#8243;\uff0c\u5c06\u4f1a\u901a\u8fc7 KMS \u5bc6\u94a5\u7ba1\u7406\u670d\u52a1\u5668\u6fc0\u6d3b Windows \u52302038\u5e74\uff0c\u8fd9\u79cd\u65b9\u5f0f\u53ef\u4ee5\u6fc0\u6d3b Windows Server\uff0c\u5e76\u4e14\u4e0d\u9700\u8981\u8054\u7f51\u3002<\/p>\n\n\n\n<p>\u5982\u679c\u6309\u4e0b\u952e\u76d8&#8221;4&#8243;\uff0c\u5c06\u4f1a\u901a\u8fc7\u5728\u7ebf KMS \u65b9\u5f0f\u6fc0\u6d3b Windows \u548c Office\u3002\u6bcf\u6b21\u6fc0\u6d3b\u5c06\u4f1a\u7eed\u671f180\u5929\uff0c\u5230\u671f\u4f1a\u81ea\u52a8\u7eed\u671f\uff0c\u8fd9\u79cd\u65b9\u5f0f\u53ef\u4ee5\u6fc0\u6d3b Windows Server\uff0c\u4e14\u9700\u8981\u8054\u7f51\u3002<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">\u6267\u884c\u539f\u7406-\u5916\u5c42\u6267\u884c\u5668<\/h2>\n\n\n\n<blockquote class=\"wp-block-quote is-layout-flow wp-block-quote-is-layout-flow\">\n<p>\u6267\u884c\u5668\u6267\u884c\u539f\u7406\u5206\u6790\u4f7f\u75282025\u5e741\u670815\u65e5\u5feb\u7167\u3002<\/p>\n<\/blockquote>\n\n\n\n<div class=\"wp-block-group\"><div class=\"wp-block-group__inner-container is-layout-constrained wp-block-group-is-layout-constrained\">\n<p>\u5f53\u4f60\u5728Powershell\u4e2d\u8f93\u5165\u4e86<code>irm https:\/\/get.activated.win | iex<\/code>\u65f6\uff0c\u5177\u4f53\u53d1\u751f\u4e86\u4ec0\u4e48\uff1f<\/p>\n\n\n\n<p>Powershell \u4f1a\u5411 <a href=\"https:\/\/get.activated.win\" target=\"_blank\" rel=\"noreferrer noopener\">https:\/\/get.activated.win<\/a> \u53d1\u9001\u4e00\u4e2a HTTP GET \u8bf7\u6c42\uff0c\u8fd9\u4f1a\u8fd4\u56de\u4e00\u4e2a\u5b57\u7b26\u4e32\u5f62\u5f0f\u7684 Powershell \u811a\u672c\uff0c\u5e76\u901a\u8fc7\u7ba1\u9053\u7b26\u53f7 &#8220;|&#8221; \u4f20\u9012\u7ed9 <code>iex<\/code> \u6267\u884c\u3002<\/p>\n\n\n\n<p>\u9996\u5148\uff0c\u811a\u672c\u68c0\u67e5\u5f53\u524d Powershell \u662f\u5426\u8fd0\u884c\u5728\u5b8c\u5168\u8bed\u8a00\u6a21\u5f0f\uff08LanguageMode.value__ = 0\uff09\uff1a<\/p>\n<\/div><\/div>\n\n\n\n<pre class=\"wp-block-code\"><code>if ($ExecutionContext.SessionState.LanguageMode.value__ -ne 0) {\n    $ExecutionContext.SessionState.LanguageMode\n    Write-Host \"Windows PowerShell is not running in Full Language Mode.\"\n    Write-Host \"Help - https:\/\/massgrave.dev\/fix_powershell\" -ForegroundColor White -BackgroundColor Blue\n    return\n}<\/code><\/pre>\n\n\n\n<p>\u5982\u679c\u8fd0\u884c\u5728\u53d7\u9650\u6a21\u5f0f\uff08\u4f8b\u5982 ConstrainedLanguage \u6a21\u5f0f\uff09\u4e0b\uff0c\u811a\u672c\u4f1a\u4e2d\u65ad\u8fd0\u884c\uff0c\u5e76\u63d0\u793a\u7528\u6237\u8bbf\u95ee\u4e00\u4e2a\u5e2e\u52a9\u94fe\u63a5<a href=\"https:\/\/massgrave.dev\/fix_powershell\">https:\/\/massgrave.dev\/fix_powershel<\/a><a href=\"https:\/\/massgrave.dev\/fix_powershell\" target=\"_blank\" rel=\"noreferrer noopener\">l<\/a>\u3002<\/p>\n\n\n\n<p>\u8bbe\u7f6e\u7f51\u7edc\u901a\u4fe1\u5b89\u5168\u534f\u8bae\u4e3a<code>TLS 1.2<\/code>\uff1a<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>&#91;Net.ServicePointManager]::SecurityProtocol = &#91;Net.SecurityProtocolType]::Tls12<\/code><\/pre>\n\n\n\n<p>\u7136\u540e\uff0c\u5c1d\u8bd5\u4ece\u591a\u4e2a\u5730\u70b9\u4e0b\u8f7d\u6fc0\u6d3b\u811a\u672c<code>MAS_AIO.cmd<\/code>\uff1a<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>$URLs = @(\n    'https:\/\/raw.githubusercontent.com\/massgravel\/Microsoft-Activation-Scripts\/37ec96504a2983a5801c43e975ab78c8f9315d2a\/MAS\/All-In-One-Version-KL\/MAS_AIO.cmd',\n    'https:\/\/dev.azure.com\/massgrave\/Microsoft-Activation-Scripts\/_apis\/git\/repositories\/Microsoft-Activation-Scripts\/items?path=\/MAS\/All-In-One-Version-KL\/MAS_AIO.cmd&amp;versionType=Commit&amp;version=37ec96504a2983a5801c43e975ab78c8f9315d2a',\n    'https:\/\/git.activated.win\/massgrave\/Microsoft-Activation-Scripts\/raw\/commit\/37ec96504a2983a5801c43e975ab78c8f9315d2a\/MAS\/All-In-One-Version-KL\/MAS_AIO.cmd'\n)\n\nforeach ($URL in $URLs | Sort-Object { Get-Random }) {\n    try { $response = Invoke-WebRequest -Uri $URL -UseBasicParsing; break } catch {}\n}<\/code><\/pre>\n\n\n\n<p>\u5982\u679c\u4e0b\u8f7d\u5931\u8d25\u4e14\u5f53\u524d\u7cfb\u7edf\u4f7f\u7528\u7b2c\u4e09\u65b9\u6740\u6bd2\u8f6f\u4ef6\uff0c\u63d0\u9192\u7528\u6237\u7b2c\u4e09\u65b9\u6740\u6bd2\u8f6f\u4ef6\u53ef\u80fd\u4f1a\u5bfc\u81f4\u4e0b\u8f7d\u5931\u8d25\uff1a<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>function Check3rdAV {\n    $avList = Get-CimInstance -Namespace root\\SecurityCenter2 -Class AntiVirusProduct | Where-Object { $_.displayName -notlike '*windows*' } | Select-Object -ExpandProperty displayName\n    if ($avList) {\n        Write-Host '3rd party Antivirus might be blocking the script - ' -ForegroundColor White -BackgroundColor Blue -NoNewline\n        Write-Host \" $($avList -join ', ')\" -ForegroundColor DarkRed -BackgroundColor White\n    }\n}\n\nif (-not $response) {\n    Check3rdAV\n    Write-Host \"Failed to retrieve MAS from any of the available repositories, aborting!\"\n    Write-Host \"Help - https:\/\/massgrave.dev\/troubleshoot\" -ForegroundColor White -BackgroundColor Blue\n    return\n}<\/code><\/pre>\n\n\n\n<p>\u5728\u4e0b\u8f7d\u6587\u4ef6\u540e\uff0c\u4f1a\u8fdb\u884c\u5b8c\u6574\u6027\u9a8c\u8bc1\u3002<\/p>\n\n\n\n<p>\u9884\u5b9a\u4e49\u4e0b\u8f7d\u811a\u672c\u7684\u54c8\u5e0c\u503c\uff1a<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>$releaseHash = '49CE81C583C69AC739890D2DFBB908BDD67B862702DAAEBCD2D38F1DDCEE863D'<\/code><\/pre>\n\n\n\n<p>\u521d\u59cb\u5316\u5185\u5b58\u6d41\uff0c\u5c06\u811a\u672c\u5185\u5bb9\u5199\u5165\u5185\u5b58\u6d41\uff1a<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>$stream = New-Object IO.MemoryStream\n$writer = New-Object IO.StreamWriter $stream\n$writer.Write($response)\n$writer.Flush()\n$stream.Position = 0<\/code><\/pre>\n\n\n\n<p>\u8ba1\u7b97 SHA-256 \u54c8\u5e0c\u503c\uff1a<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>$hash = &#91;BitConverter]::ToString(&#91;Security.Cryptography.SHA256]::Create().ComputeHash($stream)) -replace '-'<\/code><\/pre>\n\n\n\n<p>\u5982\u679c\u65e0\u6cd5\u5339\u914d\uff0c\u8b66\u544a\u7528\u6237\u5e76\u4e2d\u6b62\u811a\u672c\u8fd0\u884c\uff1a<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>if ($hash -ne $releaseHash) {\n    Write-Warning \"Hash ($hash) mismatch, aborting!`nReport this issue at https:\/\/massgrave.dev\/troubleshoot\"\n    $response = $null\n    return\n}<\/code><\/pre>\n\n\n\n<p>\u68c0\u67e5 CMD(\u547d\u4ee4\u63d0\u793a\u7b26) Autorun\u6ce8\u518c\u8868\u9879\u662f\u5426\u5b58\u5728\uff0c\u8fd9\u5b9a\u4e49\u4e86 CMD \u542f\u52a8\u65f6\u9700\u8981\u81ea\u52a8\u6267\u884c\u7684\u547d\u4ee4\u3002\u5982\u679c\u5b58\u5728\uff0c\u8fd9\u53ef\u80fd\u4f1a\u5e72\u6270\u811a\u672c\u7684\u8fd0\u884c\u3002<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>$paths = \"HKCU:\\SOFTWARE\\Microsoft\\Command Processor\", \"HKLM:\\SOFTWARE\\Microsoft\\Command Processor\"\nforeach ($path in $paths) { \n    if (Get-ItemProperty -Path $path -Name \"Autorun\" -ErrorAction SilentlyContinue) { \n        Write-Warning \"Autorun registry found, CMD may crash! `nManually copy-paste the below command to fix...`nRemove-ItemProperty -Path '$path' -Name 'Autorun'\"\n    } \n}<\/code><\/pre>\n\n\n\n<p>\u811a\u672c\u5982\u679c\u68c0\u67e5\u5230\u6709 Autorun \u9879\u76ee\uff0c\u8b66\u544a\u7528\u6237\u8fd9\u53ef\u80fd\u4f1a\u5bfc\u81f4\u811a\u672c\u6267\u884c\u9519\u8bef\uff1a<\/p>\n\n\n\n<blockquote class=\"wp-block-quote is-layout-flow wp-block-quote-is-layout-flow\">\n<p>Autorun registry found, CMD may crash! <br>Manually copy-paste the below command to fix&#8230;<br>Remove-ItemProperty -Path &#8216;$path&#8217; -Name &#8216;Autorun&#8217;<\/p>\n<\/blockquote>\n\n\n\n<p>\u751f\u6210\u968f\u673aGUID\uff0c\u4ee5\u5b57\u7b26\u4e32\u683c\u5f0f\uff0c\u8fd9\u4e2a GUID \u5c06\u4f1a\u4f5c\u4e3a\u4fdd\u5b58\u6587\u4ef6\u7684\u6587\u4ef6\u540d\uff1a<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>$rand = &#91;Guid]::NewGuid().Guid<\/code><\/pre>\n\n\n\n<p>\u68c0\u67e5\u5f53\u524d\u7528\u6237\u662f\u5426\u6709\u7ba1\u7406\u5458\u6743\u9650\uff1a<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>$isAdmin = &#91;bool](&#91;Security.Principal.WindowsIdentity]::GetCurrent().Groups -match 'S-1-5-32-544')<\/code><\/pre>\n\n\n\n<p>\u5982\u679c\u6709\u7ba1\u7406\u5458\u6743\u9650\uff0c\u5c06\u8fdc\u7a0b\u4e0b\u8f7d\u7684\u811a\u672c\u4fdd\u5b58\u5728&#8221;$env:SystemRoot\\Temp\\MAS_$rand.cmd&#8221;\uff1b\u5426\u5219\uff0c\u4fdd\u5b58\u5728&#8221;$env:USERPROFILE\\AppData\\Local\\Temp\\MAS_$rand.cmd&#8221;\uff1a<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>$FilePath = if ($isAdmin) { \"$env:SystemRoot\\Temp\\MAS_$rand.cmd\" } else { \"$env:USERPROFILE\\AppData\\Local\\Temp\\MAS_$rand.cmd\" }<\/code><\/pre>\n\n\n\n<p>\u5c06\u4e0b\u8f7d\u7684<code>MAS_AIO.cmd<\/code>\u5185\u5bb9\u5199\u5165\u5230\u5148\u524d\u5b9a\u4e49\u7684\u4fdd\u5b58\u8def\u5f84\uff1a<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>Set-Content -Path $FilePath -Value \"@::: $rand `r`n$response\"<\/code><\/pre>\n\n\n\n<p>\u68c0\u67e5\u662f\u5426\u6210\u529f\u5199\u5165\uff0c\u5b9a\u4e49CheckFile\u51fd\u6570\uff1a<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>function CheckFile { \n    param (&#91;string]$FilePath) \n    if (-not (Test-Path $FilePath)) { \n        Check3rdAV\n        Write-Host \"Failed to create MAS file in temp folder, aborting!\"\n        Write-Host \"Help - https:\/\/massgrave.dev\/troubleshoot\" -ForegroundColor White -BackgroundColor Blue\n        throw \n    } \n}\n\nCheckFile $FilePath<\/code><\/pre>\n\n\n\n<p>\u4f7f\u7528 CMD \u6267\u884c\u4fdd\u5b58\u7684\u811a\u672c\uff1a<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>$env:ComSpec = \"$env:SystemRoot\\system32\\cmd.exe\"\nStart-Process -FilePath $env:ComSpec -ArgumentList \"\/c \"\"\"\"$FilePath\"\" $args\"\"\" -Wait\nCheckFile $FilePath<\/code><\/pre>\n\n\n\n<p>\u6700\u540e\uff0c\u6e05\u9664\u4ea7\u751f\u7684\u4e34\u65f6\u6587\u4ef6\uff1a<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>$FilePaths = @(\"$env:SystemRoot\\Temp\\MAS<em>.cmd\", \"$env:USERPROFILE\\AppData\\Local\\Temp\\MAS<\/em>.cmd\")\nforeach ($FilePath in $FilePaths) { Get-Item $FilePath | Remove-Item }<\/code><\/pre>\n\n\n\n<h2 class=\"wp-block-heading\">\u6267\u884c\u539f\u7406-\u5185\u5c42\u6fc0\u6d3b\u811a\u672c-HWID\u90e8\u5206<\/h2>\n\n\n\n<blockquote class=\"wp-block-quote is-layout-flow wp-block-quote-is-layout-flow\">\n<p>\u6fc0\u6d3b\u811a\u672c\u539f\u7406\u5206\u6790\u4f7f\u75282025\u5e741\u670815\u65e5\u5feb\u7167\u3002<\/p>\n<\/blockquote>\n\n\n\n<p>\u5185\u5c42\u6fc0\u6d3b\u811a\u672c\u6709\u8bb8\u591a\u5b89\u5168\u4fdd\u62a4\u548c\u4e3a\u4e86\u9632\u6b62\u6267\u884c\u73af\u5883\u53d8\u6362\u5bfc\u81f4\u6267\u884c\u5931\u8d25\u7684\u9884\u5b9a\u4e49\uff0c\u5728\u7814\u7a76\u6267\u884c\u539f\u7406\u65f6\uff0c\u6211\u4eec\u5c06\u4ec5\u5173\u6ce8\u6838\u5fc3\u6267\u884c\u811a\u672c\u3002<\/p>\n\n\n\n<p>\u68c0\u6d4b\u5f53\u524d\u7cfb\u7edf\u6240\u80fd\u4f7f\u7528\u7684\u6240\u6709\u5bc6\u94a5\u5e76\u5b89\u88c5\u5b83\uff1a<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>::  Detect Key\n\nset key=\nset altkey=\nset changekey=\nset altapplist=\nset altedition=\nset notworking=\n\ncall :dk_actids 55c92734-d682-4d71-983e-d6ec3f16059f\nif defined allapps call :hwiddata key\nif not defined key (\nfor \/f \"delims=\" %%a in ('%psc% \"$f=&#91;io.file]::ReadAllText('!_batp!') -split ':getactivationid\\:.*';iex ($f&#91;1])\"') do (set altapplist=%%a)\nif defined altapplist call :hwiddata key\n)\n\nif defined notworking call :hwidfallback\nif not defined key call :hwidfallback\n\nif defined altkey (set key=%altkey%&amp;set changekey=1&amp;set notworking=)\n\nif defined notworking if defined notfoundaltactID (\ncall :dk_color %Red% \"Checking Alternate Edition For HWID     &#91;%altedition% Activation ID Not Found]\"\n)\n\nif not defined key (\n%eline%\necho &#91;%winos% ^| %winbuild% ^| SKU:%osSKU%]\nif not defined skunotfound (\necho This product does not support HWID activation.\necho Make sure you are using the latest version of the script.\necho If you are, then try KMS38 activation option.\nset fixes=%fixes% %mas%\necho %mas%\n) else (\necho Required license files not found in %SysPath%\\spp\\tokens\\skus\\\nset fixes=%fixes% %mas%troubleshoot\ncall :dk_color2 %Blue% \"Help - \" %_Yellow% \" %mas%troubleshoot\"\n)\necho:\ngoto dk_done\n)\n\nif defined notworking set error=1<\/code><\/pre>\n\n\n\n<p><code>call :dk_actids 55c92734-d682-4d71-983e-d6ec3f16059f<\/code> \u8c03\u7528<code>dk_actids<\/code>\u4e3a Windows \u64cd\u4f5c\u7cfb\u7edf\u6fc0\u6d3b\u5bf9\u5e94\u7684 App ID (\u5373<code>55c92734-d682-4d71-983e-d6ec3f16059f<\/code>) \u67e5\u627e\u6240\u6709\u7684\u53ef\u7528\u7684\u6fc0\u6d3bID\uff0c\u5e76\u5b58\u50a8\u81f3<code>allapps<\/code>\uff1a<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>::  Get all products Activation IDs\n\n:dk_actids\n\nset allapps=\nif %_wmic% EQU 1 set \"chkapp=for \/f \"tokens=2 delims==\" %%a in ('\"wmic path %spp% where (ApplicationID='%1') get ID \/VALUE\" %nul6%')\"\nif %_wmic% EQU 0 set \"chkapp=for \/f \"tokens=2 delims==\" %%a in ('%psc% \"((&#91;WMISEARCHER]'SELECT ID FROM %spp% WHERE ApplicationID=''%1''').Get()).ID ^| %% {echo ('ID='+$_)}\" %nul6%')\"\n%chkapp% do (if defined allapps (call set \"allapps=!allapps! %%a\") else (call set \"allapps=%%a\"))\n\n::  Check potential script crash issue when user manually installs way too many licenses for Office (length limit in variable)\n\nif defined allapps if %1==0ff1ce15-a989-479d-af46-f275c6370663 (\nset len=0\necho:!allapps!&gt; %SystemRoot%\\Temp\\chklen\nfor %%A in (%SystemRoot%\\Temp\\chklen) do (set len=%%~zA)\ndel %SystemRoot%\\Temp\\chklen %nul%\n\nif !len! GTR 6000 (\n%eline%\necho Too many licenses are installed, the script may crash.\ncall :dk_color %Blue% \"%_fixmsg%\"\ntimeout \/t 30\n)\n)\nexit \/b<\/code><\/pre>\n\n\n\n<p>\u5982\u679c\u627e\u5230\u4e86\u6709\u6548\u7684<code>allapps<\/code>\uff0c\u8c03\u7528<code>hwiddata<\/code>\u5b50\u8fdb\u7a0b (\u4ee5<code>key<\/code>\u4e3a\u53c2\u6570\uff0c\u6307\u793a\u641c\u7d22\u53ef\u7528\u6fc0\u6d3b\u914d\u7f6e)\uff1a<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>::  1st column = Activation ID\n::  2nd column = Generic Retail\/OEM\/MAK Key\n::  3rd column = SKU ID\n::  4th column = Key part number\n::  5th column = Ticket signature value. It's as it is, it's not encoded. (Check mass grave&#91;.]dev\/hwid#manual-activation to see how it's generated)\n::  6th column = 1 = activation is not working (at the time of writing this), 0 = activation is working\n::  7th column = Key Type\n::  8th column = WMI Edition ID (For reference only)\n::  9th column = Version name incase same Edition ID is used in different OS versions with different key\n::  Separator  = _\n\n\n:hwiddata\n\nset f=\nfor %%# in ( ... ) do (\nfor \/f \"tokens=1-9 delims=_\" %%A in (\"%%#\") do (\n\nREM Detect key\n\nif %1==key if %osSKU%==%%C if not defined key (\necho \"!allapps! !altapplist!\" | find \/i \"%%A\" %nul1% &amp;&amp; (\nif %%F==1 set notworking=1\nset key=%%B\n)\n)\n\nREM Generate ticket\n\nif %1==ticket if \"%key%\"==\"%%B\" (\nset \"string=OSMajorVersion=5;OSMinorVersion=1;OSPlatformId=2;PP=0;Pfn=Microsoft.Windows.%%C.%%D_8wekyb3d8bbwe;PKeyIID=465145217131314304264339481117862266242033457260311819664735280;$(&#91;char]0)\"\nfor \/f \"tokens=* delims=\" %%i in ('%psc% &#91;conv%f%ert]::ToBas%f%e64String(&#91;Text.En%f%coding]::Uni%f%code.GetBytes(\"\"\"!string!\"\"\"^)^)') do set \"encoded=%%i\"\necho \"!encoded!\" | find \"AAAA\" %nul1% || exit \/b\n\n&lt;nul set \/p \"=&lt;?xml version=\"1.0\" encoding=\"utf-8\"?&gt;&lt;genuineAuthorization xmlns=\"http:\/\/www.microsoft.com\/DRM\/SL\/GenuineAuthorization\/1.0\"&gt;&lt;version&gt;1.0&lt;\/version&gt;&lt;genuineProperties origin=\"sppclient\"&gt;&lt;properties&gt;OA3xOriginalProductId=;OA3xOriginalProductKey=;SessionId=!encoded!;TimeStampClient=2022-10-11T12:00:00Z&lt;\/properties&gt;&lt;signatures&gt;&lt;signature name=\"clientLockboxKey\" method=\"rsa-sha256\"&gt;%%E=&lt;\/signature&gt;&lt;\/signatures&gt;&lt;\/genuineProperties&gt;&lt;\/genuineAuthorization&gt;\" &gt;\"%tdir%\\GenuineTicket\"\n)\n\n)\n)\nexit \/b<span class=\"glarity-read-retry-wrapper glarity-translation-retry\"><span class=\"glarity-read-reason\"><\/span><span class=\"glarity-read-reason\"><\/span><span class=\"glarity-read-reason\"><\/span><span class=\"glarity-read-reason\"><\/span><span class=\"glarity-read-reason\"><\/span><\/span><\/code><\/pre>\n\n\n\n<p><code>for %%# in ( ... )<\/code>\u5185\u542b\u591a\u4e2a\u9884\u8bbe\u7684\u6fc0\u6d3b\u4fe1\u606f\u4e32\uff0c\u6bcf\u4e00\u4e32\u901a\u8fc7<code>_<\/code>\u5206\u5272\u4e3a9\u4e2a\u5b57\u6bb5\uff0c\u6bcf\u4e2a\u5b57\u6bb5\u5305\u542b\u4ee5\u4e0b\u4fe1\u606f\uff1a<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>\u6fc0\u6d3b ID<\/li>\n\n\n\n<li>\u5bc6\u94a5<\/li>\n\n\n\n<li>\u4ea7\u54c1 ID<\/li>\n\n\n\n<li>\u5bc6\u94a5\u90e8\u4ef6\u7801<\/li>\n\n\n\n<li>\u5bc6\u94a5\u7b7e\u540d\u503c<\/li>\n\n\n\n<li>\u6fc0\u6d3b\u72b6\u6001\uff0c0\u8868\u793a\u53ef\u6fc0\u6d3b\uff0c1\u8868\u793a\u4e0d\u53ef\u6fc0\u6d3b<\/li>\n\n\n\n<li>\u5bc6\u94a5\u7c7b\u578b<\/li>\n\n\n\n<li>WMI \u7248\u672c\u540d\u79f0<\/li>\n\n\n\n<li>\u7248\u672c\u540d\u79f0\u62d3\u5c55 (\u53ef\u9009\uff0c\u7528\u4e8e\u533a\u5206\u53ef\u80fd\u7684\u6fc0\u6d3b\u8bed\u8a00)<\/li>\n<\/ul>\n\n\n\n<p>\u4f8b\u5982\uff0c\u5bf9\u4e8e\u5176\u4e2d\u4e00\u4e2a\u5b57\u4e32\uff1a<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>8b351c9c-f398-4515-9900-09df49427262_XGVPP-NMH47-7TTHJ-W3FW7-8H%f%V2C___4_X19-99683_HGNKjkKcKQHO6n8srMUrDh\/MElffBZarLqCMD9rWtgFKf3YzYOLDPEMGhuO\/auNMKCeiU7ebFbQALS\/MyZ7TvidMQ2dvzXeXXKzPBjfwQx549WJUU7qAQ9Txg9cR9SAT8b12Pry2iBk+nZWD9VtHK3kOnEYkvp5WTCTsrSi6Re4_0_OEM:NONSLP_Enterprise<\/code><\/pre>\n\n\n\n<p>\u8fd9\u4e00\u5b57\u4e32\u5bf9\u5e94\u7684\u6fc0\u6d3b\u4fe1\u606f\u5982\u4e0b\uff1a<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>\u6fc0\u6d3b ID\uff1a<code>8b351c9c-f398-4515-9900-09df49427262<\/code>\uff0c\u8fd9\u662f\u4e00\u4e2a\u7528\u4e8e\u6807\u8bc6\u6b64\u6b21\u6fc0\u6d3b\u8bf7\u6c42\u7684\u552f\u4e00GUID\u3002<\/li>\n\n\n\n<li>\u5bc6\u94a5\uff1a<code>XGVPP-NMH47-7TTHJ-W3FW7-8H%f%V2C<\/code>\uff0c\u8fd9\u662f\u4ea7\u54c1\u5bc6\u94a5\u3002<\/li>\n\n\n\n<li>\u4ea7\u54c1ID\uff1a<code>4<\/code>\uff0c\u8868\u660e\u8fd9\u662f\u4f01\u4e1a\u7248\u6fc0\u6d3b\u3002<\/li>\n\n\n\n<li>\u5bc6\u94a5\u90e8\u4ef6\u7801\uff1a<code>X19-99683<\/code>\uff0c\u8fd9\u662f\u8be5\u5bc6\u94a5\u7684\u552f\u4e00\u90e8\u4ef6\u53f7\u7801\u3002<\/li>\n\n\n\n<li>\u5bc6\u94a5\u7b7e\u540d\u503c\uff1a<code>HGNKjkKcKQHO6n8srMUrDh\/MElffBZarLqCMD9rWtgFKf3YzYOLDPEMGhuO\/auNMKCeiU7ebFbQALS\/MyZ7TvidMQ2dvzXeXXKzPBjfwQx549WJUU7qAQ9Txg9cR9SAT8b12Pry2iBk+nZWD9VtHK3kOnEYkvp5WTCTsrSi6Re4<\/code>\uff0c\u8fd9\u662f\u5bc6\u94a5\u7684\u6458\u8981\u7b7e\u540d\uff0c\u4e3a\u4e86\u786e\u4fdd\u6fc0\u6d3b\u6570\u636e\u672a\u7ecf\u7be1\u6539\u3002<\/li>\n\n\n\n<li>\u6fc0\u6d3b\u72b6\u6001\uff1a<code>0<\/code>\uff0c\u8868\u793a\u5bc6\u94a5\u662f\u53ef\u6fc0\u6d3b\u7684\u3002<\/li>\n\n\n\n<li>\u5bc6\u94a5\u7c7b\u578b\uff1a<code>OEM:NONSLP<\/code>\uff0c\u8868\u660e\u8fd9\u4e2a\u5bc6\u94a5\u662f\u4e3aOEM\u63d0\u4f9b\u7684\uff0c\u4e14\u5e76\u672a\u4f7f\u7528SLP (System Locked Pre-Installation \u9884\u88c5\u7cfb\u7edf\u9501\u5b9a) \u7ed1\u5b9a\u3002<\/li>\n\n\n\n<li>WMI \u7248\u672c\u540d\u79f0\uff1a<code>Enterprise<\/code>\uff0c\u4e00\u4e2a\u7528\u6237\u53cb\u597d\u7684\u540d\u79f0\uff0c\u8868\u660e\u8fd9\u662f\u4f01\u4e1a\u7248\u7684\u6fc0\u6d3b\u4fe1\u606f\u3002<\/li>\n\n\n\n<li>\u7248\u672c\u540d\u79f0\u62d3\u5c55\uff1a\u65e0\uff0c\u8fd9\u662f\u4e3a\u4e86\u533a\u5206\u53ef\u80fd\u7684\u6fc0\u6d3b\u8bed\u8a00\u7684\u6807\u8bc6\uff0c\u8fd9\u662f\u4e00\u4e2a\u53ef\u9009\u9879\u76ee\u3002<\/li>\n<\/ul>\n\n\n\n<p>\u6267\u884c<code>hwiddata key<\/code>\u4f1a\u5c1d\u8bd5\u5c06\u6240\u6709\u7684\u6fc0\u6d3b\u914d\u7f6e\u7684\u4ea7\u54c1ID\u5b57\u6bb5\u4e0e\u7cfb\u7edf\u7684SKU\u53f7\u7801\u5339\u914d (\u5373 <code>if %osSKU%==<em>%%C<\/em><\/code>)\uff0c\u5982\u679c\u6709\u6210\u529f\u7684\u5339\u914d\uff0c\u5c06\u6fc0\u6d3b\u5bc6\u94a5\u5199\u5165<code>key<\/code>\u53d8\u91cf\u4e2d\u4ee5\u51c6\u5907\u6fc0\u6d3b\u3002<\/p>\n\n\n\n<p>\u5728\u67e5\u627e\u5230\u53ef\u7528\u7684\u9002\u7528\u4e8e\u5f53\u524d\u7cfb\u7edf\u7684\u5bc6\u94a5\u540e\uff0c\u51c6\u5907\u5b89\u88c5\u5bc6\u94a5\uff1a<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>::  Install key\n\necho:\nif defined changekey (\ncall :dk_color %Blue% \"&#91;%altedition%] edition product key will be used to enable HWID activation.\"\necho:\n)\n\nif defined winsub (\ncall :dk_color %Blue% \"Windows Subscription &#91;SKU ID-%slcSKU%] detected. Script will activate base edition &#91;SKU ID-%regSKU%].\"\necho:\n)\n\ncall :dk_inskey \"&#91;%key%]\"<\/code><\/pre>\n\n\n\n<p>\u8fd9\u4f1a\u8c03\u7528<code>dk_inskey<\/code>\u5b50\u8fdb\u7a0b\u5b89\u88c5\u5bc6\u94a5<code>key<\/code>\uff1a<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>::  Install Key\n\n:dk_inskey\n\nif %_wmic% EQU 1 wmic path %sps% where __CLASS='%sps%' call InstallProductKey ProductKey=\"%key%\" %nul%\nif %_wmic% EQU 0 %psc% \"try { $null=((&#91;WMISEARCHER]'SELECT Version FROM %sps%').Get()).InstallProductKey('%key%'); exit 0 } catch { exit $_.Exception.InnerException.HResult }\" %nul%\nset keyerror=%errorlevel%\ncmd \/c exit \/b %keyerror%\nif %keyerror% NEQ 0 set \"keyerror=&#91;0x%=ExitCode%]\"\n\nif %keyerror% EQU 0 (\nif %sps%==SoftwareLicensingService call :dk_refresh\necho Installing Generic Product Key          %~1 &#91;Successful]\n) else (\ncall :dk_color %Red% \"Installing Generic Product Key          %~1 &#91;Failed] %keyerror%\"\nif not defined error (\nif defined altapplist call :dk_color %Red% \"Activation ID not found for this key.\"\ncall :dk_color %Blue% \"%_fixmsg%\"\nset showfix=1\n)\nset error=1\n)\n\nexit \/b<\/code><\/pre>\n\n\n\n<p><code>dk_inskey<\/code>\u4f7f\u7528<code>wmic<\/code>\u6216\u8005<code>Powershell<\/code>\u6267\u884c\u5bc6\u94a5\u5b89\u88c5\uff0c\u5c06<code>key<\/code>\u53d8\u91cf\u5bf9\u5e94\u7684\u503c\u5b89\u88c5\u4e3aWindows \u6fc0\u6d3b\u5bc6\u94a5\u3002<\/p>\n\n\n\n<p>\u5982\u679c\u7535\u8111\u62e5\u6709<code>wmic<\/code>\u670d\u52a1 (Windows Management Instrumentation Command-line)\uff0c\u811a\u672c\u4f1a\u6267\u884c\uff1a<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>wmic path %sps% where __CLASS='%sps%' call InstallProductKey ProductKey=\"%key%\" %nul%<\/code><\/pre>\n\n\n\n<p>\u5177\u4f53\u5730\uff1a<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li><code>sps<\/code>\u662f<code>SoftwareLicensingService<\/code>\uff0c\u5373\u4f7f\u7528\u8f6f\u4ef6\u6fc0\u6d3b\u670d\u52a1\u6267\u884c<code>InstallProductKey ProductKey=\"%key%\"<\/code>\u547d\u4ee4<\/li>\n\n\n\n<li><code>InstallProductKey ProductKey=\"%key%\"<\/code>\u6307\u793a\u6fc0\u6d3b\u670d\u52a1\u5b89\u88c5<code>key<\/code>\u53d8\u91cf\u6307\u5b9a\u7684\u4ea7\u54c1\u6fc0\u6d3b\u5bc6\u94a5<\/li>\n<\/ul>\n\n\n\n<p>\u5982\u679c\u7535\u8111\u6ca1\u6709<code>wmic<\/code>\u670d\u52a1\uff0c\u811a\u672c\u4f1a\u7528Powershell\u8fbe\u5230\u7c7b\u4f3c\u7684\u76ee\u7684\u3002<\/p>\n\n\n\n<p>\u5b89\u88c5\u5bc6\u94a5\u540e\uff0c\u5c06 Windows \u533a\u57df\u4e34\u65f6\u5730\u66f4\u6539\u5230\u7f8e\u56fd\u4ee5\u89c4\u907f Windows Store \u8bb8\u53ef\u5728\u8bb8\u591a\u56fd\u5bb6\u65e0\u6cd5\u6fc0\u6d3b\u7684\u95ee\u9898\uff1a<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>::  Change Windows region to USA to avoid activation issues as Windows store license is not available in many countries \n\nfor \/f \"skip=2 tokens=2*\" %%a in ('reg query \"HKCU\\Control Panel\\International\\Geo\" \/v Name %nul6%') do set \"name=%%b\"\nfor \/f \"skip=2 tokens=2*\" %%a in ('reg query \"HKCU\\Control Panel\\International\\Geo\" \/v Nation %nul6%') do set \"nation=%%b\"\n\nset regionchange=\nif not \"%name%\"==\"US\" (\nset regionchange=1\n%psc% \"Set-WinHomeLocation -GeoId 244\" %nul%\nif !errorlevel! EQU 0 (\necho Changing Windows Region To USA          &#91;Successful]\n) else (\ncall :dk_color %Red% \"Changing Windows Region To USA          &#91;Failed]\"\n)\n)<\/code><\/pre>\n\n\n\n<p>\u968f\u540e\uff0c\u6784\u9020<code>GenuineTicket.xml<\/code>\u6b63\u7248\u6fc0\u6d3b\u914d\u7f6e\u6587\u4ef6\uff1a<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>::  Generate GenuineTicket.xml and apply\n::  In some cases clipup -v -o method fails and in some cases service restart method fails as well\n::  To maximize success rate and get better error details, script will install tickets two times (service restart + clipup -v -o)\n\nset \"tdir=%ProgramData%\\Microsoft\\Windows\\ClipSVC\\GenuineTicket\"\nif not exist \"%tdir%\\\" md \"%tdir%\\\" %nul%\n\nif exist \"%tdir%\\Genuine*\" del \/f \/q \"%tdir%\\Genuine*\" %nul%\nif exist \"%tdir%\\*.xml\" del \/f \/q \"%tdir%\\*.xml\" %nul%\nif exist \"%ProgramData%\\Microsoft\\Windows\\ClipSVC\\Install\\Migration\\*\" del \/f \/q \"%ProgramData%\\Microsoft\\Windows\\ClipSVC\\Install\\Migration\\*\" %nul%\n\ncall :hwiddata ticket\n\ncopy \/y \/b \"%tdir%\\GenuineTicket\" \"%tdir%\\GenuineTicket.xml\" %nul%\n\nif not exist \"%tdir%\\GenuineTicket.xml\" (\ncall :dk_color %Red% \"Generating GenuineTicket.xml            &#91;Failed, aborting...]\"\necho &#91;%encoded%]\nif exist \"%tdir%\\Genuine*\" del \/f \/q \"%tdir%\\Genuine*\" %nul%\ngoto :dl_final\n) else (\necho Generating GenuineTicket.xml            &#91;Successful]\n)<\/code><\/pre>\n\n\n\n<p>\u8fd9\u4f1a\u8c03\u7528<code>hwiddata ticket<\/code>\uff1a<\/p>\n\n\n\n<p><code>hwiddata<\/code>\u4f1a\u627e\u5230\u5148\u524d\u5df2\u5b9a\u4e49\u7684\u4ea7\u54c1\u5bc6\u94a5\u5bf9\u5e94\u7684\u6761\u76ee\uff0c\u5e76\u6784\u5efa\u786c\u4ef6ID\u6570\u636e\u7684\u5b57\u7b26\u4e32\u5f62\u5f0f\uff1a<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>set \"string=OSMajorVersion=5;OSMinorVersion=1;OSPlatformId=2;PP=0;Pfn=Microsoft.Windows.%%C.%%D_8wekyb3d8bbwe;PKeyIID=465145217131314304264339481117862266242033457260311819664735280;$(&#91;char]0)\"<\/code><\/pre>\n\n\n\n<p>\u5c06\u5176\u8f6c\u6362\u4e3abase64\u7f16\u7801\uff1a<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>for \/f \"tokens=* delims=\" %%i in ('%psc% &#91;conv%f%ert]::ToBas%f%e64String(&#91;Text.En%f%coding]::Uni%f%code.GetBytes(\"\"\"!string!\"\"\"^)^)') do set \"encoded=%%i\"<\/code><\/pre>\n\n\n\n<p>\u68c0\u67e5\u7f16\u7801\u7ed3\u679c\u662f\u5426\u5305\u542b&#8221;AAAA&#8221;\u5b50\u4e32\uff0c\u5982\u679c\u6ca1\u6709\uff0c\u5219\u8ba4\u4e3a\u751f\u6210\u7684base64\u7f16\u7801\u4e0d\u7b26\u5408\u9884\u671f\uff0c\u7acb\u523b\u9000\u51fa\u6267\u884c\uff1a<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>echo \"!encoded!\" | find \"AAAA\" %nul1% || exit \/b<\/code><\/pre>\n\n\n\n<p>\u6784\u9020<code>GenuineTicket.xml<\/code>\u5185\u5bb9\uff0c\u5e76\u5199\u5165\u5230\u5de5\u4f5c\u76ee\u5f55\u4e0b<code>GenuineTicket<\/code>\uff1a<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>&lt;nul set \/p \"=&lt;?xml version=\"1.0\" encoding=\"utf-8\"?&gt;&lt;genuineAuthorization xmlns=\"http:\/\/www.microsoft.com\/DRM\/SL\/GenuineAuthorization\/1.0\"&gt;&lt;version&gt;1.0&lt;\/version&gt;&lt;genuineProperties origin=\"sppclient\"&gt;&lt;properties&gt;OA3xOriginalProductId=;OA3xOriginalProductKey=;SessionId=!encoded!;TimeStampClient=2022-10-11T12:00:00Z&lt;\/properties&gt;&lt;signatures&gt;&lt;signature name=\"clientLockboxKey\" method=\"rsa-sha256\"&gt;%%E=&lt;\/signature&gt;&lt;\/signatures&gt;&lt;\/genuineProperties&gt;&lt;\/genuineAuthorization&gt;\" &gt;\"%tdir%\\GenuineTicket\"<\/code><\/pre>\n\n\n\n<p>\u82e5<code>hwiddata ticket<\/code>\u6267\u884c\u5b8c\u6bd5\uff0c\u5c06\u751f\u6210\u7684<code>GenuineTicket<\/code>\u6587\u4ef6\u8986\u76d6\u590d\u5236\u4e3a<code>GenuineTicket.xml<\/code>\uff1a<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>copy \/y \/b \"%tdir%\\GenuineTicket\" \"%tdir%\\GenuineTicket.xml\" %nul%<\/code><\/pre>\n\n\n\n<p>\u5728\u5b8c\u6210\u4e86\u5bf9<code>GenuineTicket.xml<\/code>\u7684\u6784\u5efa\u540e\uff0c\u51c6\u5907\u5b89\u88c5<code>GenuineTicket.xml<\/code>\uff1a<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>set \"_xmlexist=if exist \"%tdir%\\GenuineTicket.xml\"\"\n\n%_xmlexist% (\n%psc% \"Start-Job { Restart-Service ClipSVC } | Wait-Job -Timeout 20 | Out-Null\"\n%_xmlexist% timeout \/t 2 %nul%\n%_xmlexist% timeout \/t 2 %nul%\n\n%_xmlexist% (\nset error=1\nif exist \"%tdir%\\*.xml\" del \/f \/q \"%tdir%\\*.xml\" %nul%\ncall :dk_color %Gray% \"Installing GenuineTicket.xml            &#91;Failed with ClipSVC service restart, wait...]\"\n)\n)\n\ncopy \/y \/b \"%tdir%\\GenuineTicket\" \"%tdir%\\GenuineTicket.xml\" %nul%\nclipup -v -o\n\nset rebuildinfo=\n\nif not exist %ProgramData%\\Microsoft\\Windows\\ClipSVC\\tokens.dat (\nset error=1\nset rebuildinfo=1\ncall :dk_color %Red% \"Checking ClipSVC tokens.dat             &#91;Not Found]\"\n)\n\n%_xmlexist% (\nset error=1\nset rebuildinfo=1\ncall :dk_color %Red% \"Installing GenuineTicket.xml            &#91;Failed With clipup -v -o]\"\n)\n\nif exist \"%ProgramData%\\Microsoft\\Windows\\ClipSVC\\Install\\Migration\\*.xml\" (\nset error=1\nset rebuildinfo=1\ncall :dk_color %Red% \"Checking Ticket Migration               &#91;Failed]\"\n)\n\nif not defined altapplist if not defined showfix if defined rebuildinfo (\nset showfix=1\ncall :dk_color %Blue% \"%_fixmsg%\"\n)\n\nif exist \"%tdir%\\Genuine*\" del \/f \/q \"%tdir%\\Genuine*\" %nul%<\/code><\/pre>\n\n\n\n<p>\u7531\u4e8e<code>ClipSVC<\/code>\u65b9\u6cd5\u548c<code>clipup<\/code>\u65b9\u6cd5\u90fd\u6709\u6982\u7387\u5931\u8d25\uff0c\u4f7f\u7528\u591a\u79cd\u65b9\u6cd5\u5c1d\u8bd5\u5c06\u6784\u5efa\u7684<code>GenuineTicket.xml<\/code>\u5e94\u7528\u5230\u7cfb\u7edf\u4e2d\u4ee5\u6700\u5927\u5316\u6210\u529f\u6982\u7387\uff1a<\/p>\n\n\n\n<p>\u65b9\u6cd5\u4e00\uff1a\u91cd\u542f<code>ClipSVC<\/code>\u670d\u52a1\uff1a<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>%_xmlexist% (\n    %psc% \"Start-Job { Restart-Service ClipSVC } | Wait-Job -Timeout 20 | Out-Null\"\n    %_xmlexist% timeout \/t 2 %nul%\n    %_xmlexist% timeout \/t 2 %nul%\n\n    %_xmlexist% (\n        set error=1\n        if exist \"%tdir%\\*.xml\" del \/f \/q \"%tdir%\\*.xml\" %nul%\n        call :dk_color %Gray% \"Installing GenuineTicket.xml &#91;Failed with ClipSVC service restart, wait...]\"\n    )\n)<\/code><\/pre>\n\n\n\n<p>\u65b9\u6cd5\u4e8c\uff1a\u4f7f\u7528<code>clipup<\/code>\uff1a<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>clipup -v -o<\/code><\/pre>\n\n\n\n<p>\u68c0\u67e5\u7cfb\u7edf\u7684<code>tokens.dat<\/code>\u662f\u5426\u5b58\u5728\uff1a<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>set rebuildinfo=\n\nif not exist %ProgramData%\\Microsoft\\Windows\\ClipSVC\\tokens.dat (\n    set error=1\n    set rebuildinfo=1\n    call :dk_color %Red% \"Checking ClipSVC tokens.dat &#91;Not Found]\"\n)\n\n%_xmlexist% (\n    set error=1\n    set rebuildinfo=1\n    call :dk_color %Red% \"Installing GenuineTicket.xml &#91;Failed With clipup -v -o]\"\n)<\/code><\/pre>\n\n\n\n<p>\u5982\u679c\u4e0d\u5b58\u5728\uff0c\u6253\u5370\u9519\u8bef\u4fe1\u606f\u3002<\/p>\n\n\n\n<p>\u68c0\u67e5\u662f\u5426\u5b58\u5728\u4e0e\u8bb8\u53ef\u8bc1\u8fc1\u79fb\u76f8\u5173\u7684<code>.xml<\/code>\u6587\u4ef6\uff1a<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>if exist \"%ProgramData%\\Microsoft\\Windows\\ClipSVC\\Install\\Migration\\*.xml\" (\n    set error=1\n    set rebuildinfo=1\n    call :dk_color %Red% \"Checking Ticket Migration &#91;Failed]\"\n)<\/code><\/pre>\n\n\n\n<p>\u5982\u679c\u5b58\u5728\uff0c\u6253\u5370\u9519\u8bef\u4fe1\u606f\u3002<\/p>\n\n\n\n<p>\u6700\u540e\uff0c\u6e05\u9664\u4e34\u65f6\u6587\u4ef6\uff1a<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>if exist \"%tdir%\\Genuine*\" del \/f \/q \"%tdir%\\Genuine*\" %nul%<\/code><\/pre>\n\n\n\n<p>\u68c0\u67e5\u6fc0\u6d3b\u72b6\u6001\uff1a<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>call :dk_product\n\necho:\necho Activating...\n\ncall :dk_act\ncall :dk_checkperm\nif defined _perm (\necho:\ncall :dk_color %Green% \"%winos% is permanently activated with a digital license.\"\ngoto :dl_final\n)<\/code><\/pre>\n\n\n\n<p>\u5982\u679c\u6fc0\u6d3b\u6210\u529f\uff0c\u8fdb\u5165\u6536\u5c3e\u9636\u6bb5\uff1a<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>:dl_final\n\necho:\n\nif defined regionchange (\n%psc% \"Set-WinHomeLocation -GeoId %nation%\" %nul%\nif !errorlevel! EQU 0 (\necho Restoring Windows Region                &#91;Successful]\n) else (\ncall :dk_color %Red% \"Restoring Windows Region                &#91;Failed] &#91;%name% - %nation%]\"\n)\n)\n\nREM if %osSKU%==175 call :dk_color %Red% \"%winos% does not support activation on non-azure platforms.\"\n\n::  Trigger reevaluation of SPP's Scheduled Tasks\n\nif defined _perm (\ncall :dk_reeval %nul%\n)\ngoto :dk_done<\/code><\/pre>\n\n\n\n<p>\u5982\u679c\u5728\u6fc0\u6d3b\u4e2d\u4e34\u65f6\u4fee\u6539\u4e86Windows\u5730\u533a\uff0c\u5c06\u4f1a\u5728\u8fd9\u91cc\u66f4\u6539\u56de\u6765\uff1a<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>if defined regionchange (\n%psc% \"Set-WinHomeLocation -GeoId %nation%\" %nul%\nif !errorlevel! EQU 0 (\necho Restoring Windows Region                &#91;Successful]\n) else (\ncall :dk_color %Red% \"Restoring Windows Region                &#91;Failed] &#91;%name% - %nation%]\"\n)\n)<\/code><\/pre>\n\n\n\n<p>\u5982\u679c\u5df2\u7ecf\u6210\u529f\u6c38\u4e45\u6fc0\u6d3bWindows\uff0c\u5c1d\u8bd5\u4fee\u590d\u4e00\u4e9b<code>sppsvc<\/code>\u6709\u65f6\u5019\u7531\u4e8e\u65e0\u6cd5\u5220\u9664\u6ce8\u518c\u8868\u9879\u800c\u5bfc\u81f4\u7684\u95ee\u9898\uff1a<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>::  Trigger reevaluation, it helps in updating SPP tasks\n\n:dk_reeval\n\n::  This key is left by the system in rearm process and sppsvc sometimes fails to delete it, it causes issues in working of the Scheduled Tasks of SPP\n\nset \"ruleskey=HKU\\S-1-5-20\\Software\\Microsoft\\Windows NT\\CurrentVersion\\SoftwareProtectionPlatform\\PersistedSystemState\"\nreg delete \"%ruleskey%\" \/v \"State\" \/f %nul%\nreg delete \"%ruleskey%\" \/v \"SuppressRulesEngine\" \/f %nul%\n\nset r1=$TB = &#91;AppDomain]::CurrentDomain.DefineDynamicAssembly(4, 1).DefineDynamicModule(2, $False).DefineType(0);\nset r2=%r1% &#91;void]$TB.DefinePInvokeMethod('SLpTriggerServiceWorker', 'sppc.dll', 22, 1, &#91;Int32], @(&#91;UInt32], &#91;IntPtr], &#91;String], &#91;UInt32]), 1, 3);\nset d1=%r2% &#91;void]$TB.CreateType()::SLpTriggerServiceWorker(0, 0, 'reeval', 0)\n%psc% \"Start-Job { Stop-Service sppsvc -force } | Wait-Job -Timeout 20 | Out-Null; %d1%\"\nexit \/b<\/code><\/pre>\n\n\n\n<p>\u6700\u540e\uff0c\u6253\u5370\u6536\u5c3e\u4fe1\u606f\uff1a<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>:dk_done\n\necho:\nif %_unattended%==1 timeout \/t 2 &amp; exit \/b\n\nif defined fixes (\ncall :dk_color %White% \"Follow ALL the ABOVE blue lines.   \"\ncall :dk_color2 %Blue% \"Press &#91;1] to Open Support Webpage \" %Gray% \" Press &#91;0] to Ignore\"\nchoice \/C:10 \/N\nif !errorlevel!==1 (for %%# in (%fixes%) do (start %%#))\n)\n\nif defined terminal (\ncall :dk_color %_Yellow% \"Press &#91;0] key to %_exitmsg%...\"\nchoice \/c 0 \/n\n) else (\ncall :dk_color %_Yellow% \"Press any key to %_exitmsg%...\"\npause %nul1%\n)\n\nexit \/b<\/code><\/pre>\n","protected":false},"excerpt":{"rendered":"<p>tl;dr \u5728 Powershell \u4e2d\u8fd0\u884c\u4ee5\u4e0b\u6307\u4ee4\uff1a \u8fd9\u6761\u547d\u4ee4\u4f1a\u6267\u884c\u5728https:\/\/get.activat [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[3],"tags":[12,13,14],"class_list":["post-135","post","type-post","status-publish","format-standard","hentry","category-windows","tag-windows","tag-windows-10","tag-windows-11"],"_links":{"self":[{"href":"https:\/\/blog.hcha.site\/index.php?rest_route=\/wp\/v2\/posts\/135","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/blog.hcha.site\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/blog.hcha.site\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/blog.hcha.site\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/blog.hcha.site\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=135"}],"version-history":[{"count":1,"href":"https:\/\/blog.hcha.site\/index.php?rest_route=\/wp\/v2\/posts\/135\/revisions"}],"predecessor-version":[{"id":446,"href":"https:\/\/blog.hcha.site\/index.php?rest_route=\/wp\/v2\/posts\/135\/revisions\/446"}],"wp:attachment":[{"href":"https:\/\/blog.hcha.site\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=135"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/blog.hcha.site\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=135"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/blog.hcha.site\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=135"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}