| Server IP : 123.56.80.60 / Your IP : 216.73.216.33 Web Server : Apache/2.4.54 (Win32) OpenSSL/1.1.1s PHP/7.4.33 mod_fcgid/2.3.10-dev System : Windows NT iZhx3sob14hnz7Z 10.0 build 14393 (Windows Server 2016) i586 User : SYSTEM ( 0) PHP Version : 7.4.33 Disable Function : NONE MySQL : OFF | cURL : ON | WGET : OFF | Perl : OFF | Python : OFF | Sudo : OFF | Pkexec : OFF Directory : C:/Windows/diagnostics/system/Speech/ |
Upload File : |
# Copyright © 2015, Microsoft Corporation. All rights reserved.
. .\CL_RTF.ps1
. .\CL_RegSnapin.ps1
Import-LocalizedData -BindingVariable localizationString -FileName CL_LocalizationData.psd1
Function Get-DefaultMicrophoneLevel()
{
$type = "microphone/headset microphone"
[string]$id = $null
[string]$dll = "$env:windir\diagnostics\system\audio\AudioDiagnosticSnapIn.dll"
[string]$namespace = "AudioDiagCommandSnapin"
[int]$micLevel = -1
$DefaultMicDevice = $null
$DefaultMicDeviceInfo = $null
try
{
RegSnapin $dll $namespace
##
## Get all audio capture devices
##
[Array]$AudioDevices = $null
Parse-List $type | ForEach-Object {
if (-not([String]::IsNullOrEmpty($type)))
{
$AudioDevices += Get-AudioDevice -typename "$_"
}
}
##
## Get the default device
##
foreach ($InputDevice in $AudioDevices)
{
$DeviceInfo = Get-AudioDevice -id $InputDevice.DeviceID
try{
if ($DeviceInfo.IsDefaultAudioDevice("") -eq $true)
{
$DefaultMicSet = $true
$DefaultMicDevice = $InputDevice
$DefaultMicDeviceInfo = $DeviceInfo
break
}
}
catch {}
}
##
## Test the default mic for known problems
##
if ($DefaultMicSet -eq $true)
{
$micLevel = $DefaultMicDeviceInfo.MasterVolume
}
else
{
}
}
finally {
UnregSnapin $dll $namespace
}
return $micLevel
}
<#
Function Description:
Splits and cleanses forward slash delimited string
Arguments:
$list - forward slash delimited string
Return values:
Array of strings
#>
function Parse-List([string]$list = $(throw "No list is specified"))
{
if($list -eq $null)
{
return $null
}
return $list.Split("/", [StringSplitOptions]::RemoveEmptyEntries)
}
<#
Function Description:
Determines if trouble page has ever been displayed
Arguments:
None
Return Values:
TRUE if page has been displayed, FALSE if never displayed
#>
function Get-TroublePageDisplayed()
{
[bool]$result = $false
if ((test-path $MicWizRegKey) -eq $true)
{
$MicWizRegKeyProperties = Get-ItemProperty -Path $MicWizRegKey
$result = $MicWizRegKeyProperties.$MicWizLastRunValue -ne $null
}
return $result
}
<#
Function Description:
Sets registry value indicating when trouble page was last displayed
Arguments:
None
Return Values:
None
#>
function Set-TroublePageDisplayed()
{
if ((test-path $MicWizRegKey) -eq $false)
{
new-item -Path $MicWizRegKey -Force
}
[DateTime]$lastRunDateTime = [System.DateTime]::UtcNow
[string]$lastRunRegistryData = [string]::format("{0}.{1:D2}.{2:D2}-{3:D2}.{4:D2}.{5:D2}",
$lastRunDateTime.Year, $lastRunDateTime.Month, $lastRunDateTime.Day,
$lastRunDateTime.Hour, $lastRunDateTime.Minute, $lastRunDateTime.Second)
Set-ItemProperty -Path $MicWizRegKey -Name $MicWizLastRunValue -Value $lastRunRegistryData -Force
}
<#
Function Description:
Informs the customer that calibration might be required, asks for consent, and returns the result
Arguments:
$CalibrationReason - "calibrate|default"
Return values:
True/False - If true, the customer has agreed to calibration
#>
function Get-CalibrationConsent()
{
$Header = Create-RTFHeader
$Consent = $false
$ConsentText = ""
$ConsentText = $localizationString.ConsentRTFCalibrate
$RTFSource = Add-RTFText $localizationString.ConsentRTFCalibrate
$RTFDesc = Build-RTFData $Header $RTFSource
$response = Get-DiagInput -id INT_MicSetup -Parameter @{"RTFDesc"="$RTFDesc"}
if ($response -eq "calibrate")
{
$Consent = $true
}
return $Consent
}