{"id":1722,"date":"2025-11-09T23:39:48","date_gmt":"2025-11-09T23:39:48","guid":{"rendered":"https:\/\/www.ultrexstaff.com\/?p=1722"},"modified":"2026-02-20T22:29:59","modified_gmt":"2026-02-20T22:29:59","slug":"powershell-windows-activation","status":"publish","type":"post","link":"https:\/\/www.ultrexstaff.com\/?p=1722","title":{"rendered":"Powershell Windows Activation"},"content":{"rendered":"\n<p>Updated command for Windows 10\/11 as of 2\/20\/26 &#8211;<\/p>\n\n\n\n<p>Run Powershell as an administrator, copy and paste the code below and hit enter.&nbsp; Windows should activate using Option 1 for most Windows OS&#8217;s, but use TSForge Option if you need to license a Server install. This can also be used to push through an office install.<\/p>\n\n\n\n<p>NOTE: Only use this at the approval of a supervisor. If we overuse this without the correct licensing as its foundation, we risk a customer being set up for issues in an audit. This command is to be used when Windows fails to activate a license that we know its supposed to activate, often after a Return to OOBE for Entra\/Intune Enrollment.<\/p>\n\n\n\n<p><strong>Use the one below for most reliable resolution of get.activated.win in Ultrex Office<\/strong> &#8211;<\/p>\n\n\n\n<p>iex (curl.exe -s &#8211;doh-url https:\/\/1.1.1.1\/dns-query https:\/\/get.activated.win | Out-String)<\/p>\n\n\n\n<p><\/p>\n\n\n\n<p>The following are alternative options if the one above doesn&#8217;t work (use your mobile hotspot if needed) &#8211;<\/p>\n\n\n\n<p><em>Option 1:<\/em><\/p>\n\n\n\n<p>irm\u00a0<a href=\"https:\/\/get.activated.win\/\" target=\"_blank\" rel=\"noreferrer noopener\">https:\/\/get.activated.win<\/a>\u00a0| iex<\/p>\n\n\n\n<p><em>Option 2:<\/em><\/p>\n\n\n\n<p>irm https:\/\/massgrave.dev\/get | iex<\/p>\n\n\n\n<p><\/p>\n\n\n\n<p>If none of the options above work, use this code in powershell administrator mode instead:<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">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}\n\nfunction 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\nfunction CheckFile { \n    param ([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\n[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12\n$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}\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}\n\n# Verify script integrity\n$releaseHash = '49CE81C583C69AC739890D2DFBB908BDD67B862702DAAEBCD2D38F1DDCEE863D'\n$stream = New-Object IO.MemoryStream\n$writer = New-Object IO.StreamWriter $stream\n$writer.Write($response)\n$writer.Flush()\n$stream.Position = 0\n$hash = [BitConverter]::ToString([Security.Cryptography.SHA256]::Create().ComputeHash($stream)) -replace '-'\nif ($hash -ne $releaseHash) {\n    Write-Warning \"Hash ($hash) mismatch, aborting!`nReport this issue at https:\/\/massgrave.dev\/troubleshoot\"\n    $response = $null\n    return\n}\n\n# Check for AutoRun registry which may create issues with CMD\n$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}\n\n$rand = [Guid]::NewGuid().Guid\n$isAdmin = [bool]([Security.Principal.WindowsIdentity]::GetCurrent().Groups -match 'S-1-5-32-544')\n$FilePath = if ($isAdmin) { \"$env:SystemRoot\\Temp\\MAS_$rand.cmd\" } else { \"$env:USERPROFILE\\AppData\\Local\\Temp\\MAS_$rand.cmd\" }\nSet-Content -Path $FilePath -Value \"@::: $rand `r`n$response\"\nCheckFile $FilePath\n\n$env:ComSpec = \"$env:SystemRoot\\system32\\cmd.exe\"\nStart-Process -FilePath $env:ComSpec -ArgumentList \"\/c \"\"\"\"$FilePath\"\" $args\"\"\" -Wait\nCheckFile $FilePath\n\n$FilePaths = @(\"$env:SystemRoot\\Temp\\MAS*.cmd\", \"$env:USERPROFILE\\AppData\\Local\\Temp\\MAS*.cmd\")\nforeach ($FilePath in $FilePaths) { Get-Item $FilePath | Remove-Item }<\/pre>\n\n\n\n<p>Once powershell is successful, a command prompt window will open and give you multiple options.&nbsp; Select option 1 if you only need the version of&nbsp; Windows activated.&nbsp; If you need to change the product type, there should be an option to do so in the same command dialogue box<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Updated command for Windows 10\/11 as of 2\/20\/26 &#8211; Run Powershell as an administrator, copy and paste the code below and hit enter.&nbsp; Windows should activate using Option 1 for most Windows OS&#8217;s, but use TSForge Option if you need to license a Server install. This can also be used to push through an office [&hellip;]<\/p>\n","protected":false},"author":3,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[124,118,98,113,120],"tags":[],"class_list":["post-1722","post","type-post","status-publish","format-standard","hentry","category-command-line","category-installation-guides","category-it-knowledge-base-articles","category-servers","category-windows","post-preview"],"_links":{"self":[{"href":"https:\/\/www.ultrexstaff.com\/index.php?rest_route=\/wp\/v2\/posts\/1722","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.ultrexstaff.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.ultrexstaff.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.ultrexstaff.com\/index.php?rest_route=\/wp\/v2\/users\/3"}],"replies":[{"embeddable":true,"href":"https:\/\/www.ultrexstaff.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=1722"}],"version-history":[{"count":2,"href":"https:\/\/www.ultrexstaff.com\/index.php?rest_route=\/wp\/v2\/posts\/1722\/revisions"}],"predecessor-version":[{"id":1850,"href":"https:\/\/www.ultrexstaff.com\/index.php?rest_route=\/wp\/v2\/posts\/1722\/revisions\/1850"}],"wp:attachment":[{"href":"https:\/\/www.ultrexstaff.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=1722"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.ultrexstaff.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=1722"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.ultrexstaff.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=1722"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}