How do I disable cortana from the command line?

I'm using SaltStack to configure some Windows 10 machines and one of the things I need to do is disable Cortana. I know that i can easily be disabled from its own settings is there way to do this from CMD so that I can just run it through salt?


Solution 1:

Cortana can be disabled via Group Policy on most versions of Windows 10 other than Windows 10 Home edition.

One way to do that is with the REG.EXE command at an elevated or local administrator command prompt, or in a BAT file run as administrator:

reg.exe add "HKLM\SOFTWARE\Policies\Microsoft\Windows\Windows Search" /v "AllowCortana" /t REG_DWORD /d 0

Explanation:

The group policy ADMX for it is located at: C:\Windows\PolicyDefinitions\search.admx

You can look at this ADMX by pressing WindowsKey + R and opening it with notepad:

notepad C:\Windows\PolicyDefinitions\search.admx

For the Windows 10 version 21H2 that I am using, it contains the following:

<policy name="AllowCortana" class="Machine" 
displayName="$(string.AllowCortana)" explainText="$(string.ExplainAllowCortana)"
key="SOFTWARE\Policies\Microsoft\Windows\Windows Search" 
valueName="AllowCortana">
  <parentCategory ref="Search" />
  <supportedOn ref="windows:SUPPORTED_Windows_10_0" />
  <enabledValue>
    <decimal value="1" />
  </enabledValue>
  <disabledValue>
    <decimal value="0" />
  </disabledValue>
</policy>

So deciphering this, it is policy class Machine so it is in the Local Machine Registry hive, or HKLM.

The key where it is located in the registry is: SOFTWARE\Policies\Microsoft\Windows\Windows Search

And if it is disabled, that is a decimal value (or DWORD) of 0 for value name AllowCortana

So to disable Cortana you just need to go to "HKLM\SOFTWARE\Policies\Microsoft\Windows\Windows Search" and create value name "AllowCortana" of type DWORD with a value of 0.

 

Also if you are disabling Cortana, you may also want to look into disabling searching the web as well.

reg.exe add "HKLM\SOFTWARE\Policies\Microsoft\Windows\Windows Search" /v "ConnectedSearchUseWeb" /t REG_DWORD /d 0

The ADMX policy looks like this:

<policy name="DoNotUseWebResults" class="Machine"
displayName="$(string.DoNotUseWebResults)"
explainText="$(string.ExplainDoNotUseWebResults)"
key="SOFTWARE\Policies\Microsoft\Windows\Windows Search" 
valueName="ConnectedSearchUseWeb">
  <parentCategory ref="Search" />
  <supportedOn ref="WinBlueOnly" />
  <enabledValue>
    <decimal value="0" />
  </enabledValue>
  <disabledValue>
    <decimal value="1" />
  </disabledValue>
</policy>

Disabling either of these search options still allows searching for files on the computer and in the cloud. If you want to disable that as well, it's all in the ADMX.