{"id":16452,"date":"2025-06-30T13:29:23","date_gmt":"2025-06-30T11:29:23","guid":{"rendered":"https:\/\/www.beseit.net\/?p=16452"},"modified":"2025-07-01T18:16:44","modified_gmt":"2025-07-01T16:16:44","slug":"script-powershell-per-installar-veus-onecore-per-idioma-powhershell-5-o-7","status":"publish","type":"post","link":"http:\/\/www.beseit.net\/?p=16452","title":{"rendered":"Script PowerShell per instal\u00b7lar veus OneCore per idioma"},"content":{"rendered":"\n<p>Aquest script utilitza <code>Add-WindowsCapability<\/code> per instal\u00b7lar els <strong>paquets de veu<\/strong> oficials de Microsoft via DISM (eina integrada).<\/p>\n\n\n\n<p>varificar la versi\u00f3 de powershell<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>$PSVersionTable.PSVersion<\/code><\/pre>\n\n\n\n<pre class=\"wp-block-preformatted\">powershellCopiaModifica<\/pre>\n\n\n\n<pre class=\"wp-block-code\"><code># Idiomes i veus que vols instal\u00b7lar\n$languageTags = @(\n    \"en-US\",   # English (US)\n    \"en-GB\",   # English (UK)\n    \"es-ES\",   # Spanish (Spain)\n    \"ca-ES\",   # Catalan (Spain)\n    \"fr-FR\",   # French (France)\n    \"de-DE\"    # German\n)\n\nforeach ($lang in $languageTags) {\n    Write-Host \"Instal\u00b7lant veu per a $lang...\" -ForegroundColor Cyan\n    try {\n        # Instal\u00b7la la llengua si no existeix\n        $langList = Get-WinUserLanguageList\n        if (-not ($langList.LanguageTag -contains $lang)) {\n            $langList.Add($lang)\n            Set-WinUserLanguageList $langList -Force\n        }\n\n        # Instal\u00b7la la veu OneCore associada\n        $capability = \"Language.$lang~Basic~~~\"\n        Add-WindowsCapability -Online -Name $capability -ErrorAction Stop\n\n        # Opcional: activa reconeixement de parla\n        $speechCap = \"Language.$lang~Speech~~~\"\n        Add-WindowsCapability -Online -Name $speechCap -ErrorAction SilentlyContinue\n    }\n    catch {\n        Write-Warning \"Error instal\u00b7lant per a $lang: $_\"\n    }\n}\n<\/code><\/pre>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n\n\n\n<h2 class=\"wp-block-heading\">? Qu\u00e8 fa aquest script?<\/h2>\n\n\n\n<p>\u2714\ufe0f <strong>Funciona amb PowerShell 5.x<\/strong> (Windows PowerShell): parcialment en 7<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>Afegeix l&#8217;idioma si cal.<\/li>\n\n\n\n<li>Instal\u00b7la la veu (OneCore).<\/li>\n\n\n\n<li>Intenta afegir tamb\u00e9 el reconeixement de veu (opcional).<\/li>\n\n\n\n<li>Funciona en <strong>Windows 10 i 11<\/strong>, per\u00f2 cal <strong>acc\u00e9s d&#8217;administrador<\/strong>.<\/li>\n\n\n\n<li><\/li>\n<\/ul>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n\n\n\n<h2 class=\"wp-block-heading\">2. ? <strong>Comprova que les veus apareixen a OneCore:<\/strong><\/h2>\n\n\n\n<pre class=\"wp-block-code\"><code>Get-ChildItem \"HKLM:\\SOFTWARE\\Microsoft\\Speech_OneCore\\Voices\\Tokens\" | ForEach-Object {\n    $keyPath = $_.PSPath\n    $subkeys = Get-ChildItem -Path $keyPath -ErrorAction SilentlyContinue\n    $displayName = $null\n\n    foreach ($subkey in $subkeys) {\n        $subProps = Get-ItemProperty -Path $subkey.PSPath -ErrorAction SilentlyContinue\n        if ($subProps.DisplayName) {\n            $displayName = $subProps.DisplayName\n            break\n        }\n    }\n\n    &#91;PSCustomObject]@{\n        VoiceId = $_.PSChildName\n        Name    = $displayName\n        Path    = $keyPath\n    }\n}\n\n<\/code><\/pre>\n\n\n\n<p>i a  powerhshell<\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"962\" height=\"708\" src=\"https:\/\/www.beseit.net\/wp-content\/uploads\/2025\/06\/image-23.png\" alt=\"\" class=\"wp-image-16459\" srcset=\"http:\/\/www.beseit.net\/wp-content\/uploads\/2025\/06\/image-23.png 962w, http:\/\/www.beseit.net\/wp-content\/uploads\/2025\/06\/image-23-300x221.png 300w, http:\/\/www.beseit.net\/wp-content\/uploads\/2025\/06\/image-23-768x565.png 768w, http:\/\/www.beseit.net\/wp-content\/uploads\/2025\/06\/image-23-408x300.png 408w\" sizes=\"auto, (max-width: 962px) 100vw, 962px\" \/><\/figure>\n\n\n\n<p>&#8212;&#8212;- &#8212;- &#8212;-<br>MSTTS_V110_caES_Herena Microsoft.PowerShell.Core\\Registry::HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\Speech_OneCor\u2026<br>MSTTS_V110_deDE_HeddaM Microsoft.PowerShell.Core\\Registry::HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\Speech_OneCor\u2026<br>MSTTS_V110_deDE_KatjaM Microsoft.PowerShell.Core\\Registry::HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\Speech_OneCor\u2026<br>MSTTS_V110_deDE_StefanM Microsoft.PowerShell.Core\\Registry::HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\Speech_OneCor\u2026<br>MSTTS_V110_enGB_GeorgeM Microsoft.PowerShell.Core\\Registry::HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\Speech_OneCor\u2026<br>MSTTS_V110_enGB_HazelM Microsoft.PowerShell.Core\\Registry::HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\Speech_OneCor\u2026<br>MSTTS_V110_enGB_SusanM Microsoft.PowerShell.Core\\Registry::HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\Speech_OneCor\u2026<br>MSTTS_V110_enUS_DavidM Microsoft.PowerShell.Core\\Registry::HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\Speech_OneCor\u2026<br>MSTTS_V110_enUS_MarkM Microsoft.PowerShell.Core\\Registry::HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\Speech_OneCor\u2026<br>MSTTS_V110_enUS_ZiraM Microsoft.PowerShell.Core\\Registry::HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\Speech_OneCor\u2026<br>MSTTS_V110_esES_HelenaM Microsoft.PowerShell.Core\\Registry::HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\Speech_OneCor\u2026<br>MSTTS_V110_esES_LauraM Microsoft.PowerShell.Core\\Registry::HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\Speech_OneCor\u2026<br>MSTTS_V110_esES_PabloM Microsoft.PowerShell.Core\\Registry::HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\Speech_OneCor\u2026<\/p>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n\n\n\n<p><strong>veus cl\u00e0ssiques (SAPI5)<\/strong><\/p>\n\n\n\n<pre class=\"wp-block-code\"><code># Carrega la biblioteca TTS cl\u00e0ssica\nAdd-Type -AssemblyName System.Speech\n\n# Crea un objecte per accedir al sintetitzador de veu\n$voiceSynth = New-Object System.Speech.Synthesis.SpeechSynthesizer\n\n# Obtenir totes les veus instal\u00b7lades\n$voices = $voiceSynth.GetInstalledVoices()\n\n# Mostra informaci\u00f3 detallada de cada veu\nforeach ($v in $voices) {\n    &#91;PSCustomObject]@{\n        Name        = $v.VoiceInfo.Name\n        Culture     = $v.VoiceInfo.Culture\n        Gender      = $v.VoiceInfo.Gender\n        Age         = $v.VoiceInfo.Age\n        Description = $v.VoiceInfo.Description\n        Attributes  = $v.VoiceInfo.OtherProperties\n    }\n}<\/code><\/pre>\n\n\n\n<pre class=\"wp-block-code\"><code><\/code><\/pre>\n\n\n\n<p>PS C:\\Users\\urqte&gt; # Carrega la biblioteca TTS cl\u00e0ssica<br>PS C:\\Users\\urqte&gt; Add-Type -AssemblyName System.Speech<br>PS C:\\Users\\urqte&gt;<br>PS C:\\Users\\urqte&gt; # Crea un objecte per accedir al sintetitzador de veu<br>PS C:\\Users\\urqte&gt; $voiceSynth = New-Object System.Speech.Synthesis.SpeechSynthesizer<br>PS C:\\Users\\urqte&gt;<br>PS C:\\Users\\urqte&gt; # Obtenir totes les veus instal\u00b7lades<br>PS C:\\Users\\urqte&gt; $voices = $voiceSynth.GetInstalledVoices()<br>PS C:\\Users\\urqte&gt;<br>PS C:\\Users\\urqte&gt; # Mostra informaci\u00f3 detallada de cada veu<br>PS C:\\Users\\urqte&gt; foreach ($v in $voices) {<\/p>\n\n\n\n<blockquote class=\"wp-block-quote is-layout-flow wp-block-quote-is-layout-flow\">\n<blockquote class=\"wp-block-quote is-layout-flow wp-block-quote-is-layout-flow\">\n<pre class=\"wp-block-code\"><code>&#91;PSCustomObject]@{\n    Name        = $v.VoiceInfo.Name\n    Culture     = $v.VoiceInfo.Culture\n    Gender      = $v.VoiceInfo.Gender\n    Age         = $v.VoiceInfo.Age\n    Description = $v.VoiceInfo.Description\n    Attributes  = $v.VoiceInfo.OtherProperties\n}<\/code><\/pre>\n\n\n\n<p>}<\/p>\n<\/blockquote>\n<\/blockquote>\n\n\n\n<p>1 Name : Microsoft Helena Desktop<br>Culture : es-ES<br>Gender : Female<br>Age : Adult<br>Description : Microsoft Helena Desktop &#8211; Spanish (Spain)<br>Attributes :<\/p>\n\n\n\n<p>2 Name : Microsoft Hazel Desktop<br>Culture : en-GB<br>Gender : Female<br>Age : Adult<br>Description : Microsoft Hazel Desktop &#8211; English (Great Britain)<br>Attributes :<\/p>\n\n\n\n<p>3 Name : Microsoft David Desktop<br>Culture : en-US<br>Gender : Male<br>Age : Adult<br>Description : Microsoft David Desktop &#8211; English (United States)<br>Attributes :<\/p>\n\n\n\n<p>4 Name : Microsoft Zira Desktop<br>Culture : en-US<br>Gender : Female<br>Age : Adult<br>Description : Microsoft Zira Desktop &#8211; English (United States)<br>Attributes :<\/p>\n\n\n\n<p>5 Name : Microsoft Hedda Desktop<br>Culture : de-DE<br>Gender : Female<br>Age : Adult<br>Description : Microsoft Hedda Desktop &#8211; German<br>Attributes :<\/p>\n\n\n\n<p>6 Name : Vocalizer Expressive Jordi Harpo 22kHz<br>Culture : ca-ES<br>Gender : Male<br>Age : Adult<br>Description : Vocalizer Expressive Jordi Harpo 22kHz<br>Attributes :<\/p>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n\n\n\n<h2 class=\"wp-block-heading\"><mark style=\"background-color:rgba(0, 0, 0, 0);color:#e90909\" class=\"has-inline-color\">Script PowerShell \u2014 Prova de veus SAPI (Desktop)<\/mark><\/h2>\n\n\n\n<p>Add-Type -AssemblyName System.Speech<br>$tts = New-Object System.Speech.Synthesis.SpeechSynthesizer<\/p>\n\n\n\n<p>$proves = @(<br>@{ Nom = &#8220;Microsoft Helena Desktop&#8221;; Missatge = &#8220;Hola! Esta es la voz espa\u00f1ola de Microsoft Helena.&#8221; },<br>@{ Nom = &#8220;Microsoft Hazel Desktop&#8221;; Missatge = &#8220;Hello! This is the British English voice of Microsoft Hazel.&#8221; },<br>@{ Nom = &#8220;Microsoft David Desktop&#8221;; Missatge = &#8220;Hi there! I&#8217;m Microsoft David, the American English voice.&#8221; },<br>@{ Nom = &#8220;Microsoft Zira Desktop&#8221;; Missatge = &#8220;Welcome! I am Zira, the female voice for American English.&#8221; },<br>@{ Nom = &#8220;Microsoft Hedda Desktop&#8221;; Missatge = &#8220;Hallo! Ich bin Hedda, die deutsche Stimme von Microsoft.&#8221; },<br>@{ Nom = &#8220;Vocalizer Expressive Jordi Harpo 22kHz&#8221;; Missatge = &#8220;Bon dia! S\u00f3c en Jordi, la veu en catal\u00e0 del sistema.&#8221; }<br>)<\/p>\n\n\n\n<p>foreach ($prova in $proves) {<br>Write-Host &#8220;`n? Prova amb veu: $($prova.Nom)&#8221; -ForegroundColor Cyan<br>try {<br>$tts.SelectVoice($prova.Nom)<br>$tts.Speak($prova.Missatge)<br>} catch {<br>Write-Warning &#8220;\u26a0\ufe0f No s&#8217;ha pogut trobar o usar la veu: $($prova.Nom)&#8221;<br>}<br>}<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Aquest script utilitza Add-WindowsCapability per instal\u00b7lar els paquets de veu oficials de Microsoft via DISM (eina integrada). varificar la versi\u00f3 de powershell powershellCopiaModifica ? Qu\u00e8 fa aquest script? \u2714\ufe0f Funciona amb PowerShell 5.x (Windows PowerShell): parcialment en 7 2. ? &hellip; <a href=\"http:\/\/www.beseit.net\/?p=16452\">Continua llegint <span class=\"meta-nav\">&rarr;<\/span><\/a><\/p>\n","protected":false},"author":2,"featured_media":3168,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[185],"tags":[],"class_list":["post-16452","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-veus"],"_links":{"self":[{"href":"http:\/\/www.beseit.net\/index.php?rest_route=\/wp\/v2\/posts\/16452","targetHints":{"allow":["GET"]}}],"collection":[{"href":"http:\/\/www.beseit.net\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/www.beseit.net\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/www.beseit.net\/index.php?rest_route=\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"http:\/\/www.beseit.net\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=16452"}],"version-history":[{"count":10,"href":"http:\/\/www.beseit.net\/index.php?rest_route=\/wp\/v2\/posts\/16452\/revisions"}],"predecessor-version":[{"id":16471,"href":"http:\/\/www.beseit.net\/index.php?rest_route=\/wp\/v2\/posts\/16452\/revisions\/16471"}],"wp:featuredmedia":[{"embeddable":true,"href":"http:\/\/www.beseit.net\/index.php?rest_route=\/wp\/v2\/media\/3168"}],"wp:attachment":[{"href":"http:\/\/www.beseit.net\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=16452"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/www.beseit.net\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=16452"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/www.beseit.net\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=16452"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}