I'm trying to programmatically deploy "Basic Typing" for a range of languages via PowerShell to a fleet of Windows PCs. Although I am a coder, I don't have much experience in PowerShell itself.
Looking at these articles:
https://woshub.com/install-language-pack-windows-powershell/
I gather that I want to run something like this:
Install-Language -Language da-DK -ExcludeFeatures OCR, TextToSpeech, Handwriting
However, the above gives me an error:
A positional parameter cannot be found that accepts the argument 'OCR'
I assume that I'm not using the correct syntax/formatting, or the values that I'm using are not correct. Frustratingly, the MS documentation doesn't list the acceptable values for ExcludeFeatures, nor does any of its examples show how it's used.
Any help or advice would be much appreciated, thanks.
I've tried running Install-Language with only OCR or TextToSpeech as an argument for -ExcludeFeatures, but that gives the same error.
I've even tried to just run
Install-Language en-US
But I get an error "Failed to Install Language. Error Code -2147418113". This might be network access or something blocking Windows Updates, so I'll troubleshoot that separately...
As mclayton notes, -ExcludeFeatures
is a switch parameter, i.e. it acts as a flag (with state on, if specified; off, if not) and therefore accepts no arguments.[1]
The Install-Language
help topic suggests that the -ExcludeFeatures
switch abstractly requests exclusion of those features that are opt-in in an interactive installation ("the associated language Features on Demand won't be installed.")
-ExcludeFeatures
is specified, only the following features are installed for the target language:
BasicTyping
OCR
In other words:
You don't get explicit control over which features are excluded.
Among the features you were trying to exclude, -ExcludeFeatures
does exclude TextToSpeech
and Handwriting
, but not OCR
.
Therefore, run the following from an elevated session (run as administrator):
#requires -RunAsAdministrator
# NOTE: Took almost 7 minutes (!) to complete on my W11 22H2 machine
Install-Language -Language da-DK -ExcludeFeatures
[1] Technically, you may pass $true
or $false
as an argument, separated with :
(e.g, -ExcludeFeatures:$true
), which is primarily used when programmatically constructing arguments with the Boolean provided via a variable or expression; -ExcludeFeatures:$true
is in effect the same as just -ExcludeFeatures
, and -ExcludeFeatures:false
is - typically and in this case - the same as not specifying -ExcludeFeatures
. See this answer for more information.