reaper911211
Goto Top

Mikrofon Pegel per Skript einstellen

Guten Tag,

ich bin auf der Suche nach einer Möglichkeit diesen Lautstärke Pegel des Mikrofons beim Headset zu ändern in den System Einstellungen.

Also eine Möglichkeit diesen zu ändern ohne in die Systemeinstellungen manuell zu gehen. Demnach also ein Skript.

ich habe schon mehrere Verschiedene Ideen und Ansätze gefunden die auch funktionieren würden aber nicht umgesetzt werden können bei mir .

Ich schildere euch meine Situation.

Ich arbeite im Support und habe das Problem das meine Administratoren (leben außerhalb Deutschlands) der Meinung waren den Mikrofon Pegel auf +6 DB zu stellen also die höchste Einstellung die man vornehmen kann.

Wir haben dadurch das Problem das die Anwender am Telefon eher unsere Sitznachbarn beim schreiben oder atmen hören anstatt nur uns.


Wir haben Windows 10/11 Computer die von der Firma verwaltet werden. Demnach haben wir keine Administratorrechte und bekommen auch keine. Ich bräuchte eine Möglichkeit wie ich per Skript es hinbekomme ohne Administrator rechte zu nutzen und ohne fremd Software das ich eine Aufgabenplanungs Task erstellen kann um entsprechend die Einstellung auf 0db umzustellen. Die Administratoren sind nicht Verhandlungsbereit und bis man da zu einer Klärung kommen würde... haben wir Fliegende Autos auf dem freien Markt.

ich hatte schon verschiedene Mittel und Wege gefunden z.B. mit NirCMD oder über ein separates Modul von PowerShell welches als Administrator(nicht möglich) installiert werden muss.


hat hier jemand einen Einfall wie man mit einem Skript (ausführbare Skripts bei denen man nichts separat installieren muss) diesen Pegel einstellen kann ? das Manuelle Einstellen jeden morgen ist einfach nur nervig und lästig.


Also ich suche :

Ein Skript jeglicher Skriptsprache die in Windows frei nutzbar ist um den Mikrofon Pegel in Eigenschaften Beliebig anzupassen.
Es muss komplett ohne fremd Software funktionieren und ohne Administrator rechte.

ich habe einen Computer mit Windows 11 der unter der Betreuung der Administratoren liegt die den Pegel auf +6 DB gebunden haben.
ich habe zugriff auf die Aufgabenplanung um das Skript bei jedem Systemstart oder Benutzer Login ausführen zu können.


ich weiß ich verlange vielleicht etwas viel von euch aber würde mich tierisch freuen wenn jemand auch nur Ideen oder Ansätze hier reinschmeißt ich bin so langsam mit meinem Skript Latein am ende angekommen.

Content-Key: 6828414338

Url: https://administrator.de/contentid/6828414338

Printed on: May 3, 2024 at 02:05 o'clock

Member: beidermachtvongreyscull
beidermachtvongreyscull Apr 19, 2023 at 05:12:05 (UTC)
Goto Top
Moin,

Du kannst nach meinem Kenntnisstand in Abhängigkeit zur verwendeten TK-Anlage(nsoftware) das durchaus auch selbst einstellen. Es wäre aber interessant zu erfahren, welche TK-Anlagenlösung bei Euch im Einsatz ist.

Bei SwyxIt und Netphone geht das durchaus, wenn die Registryschlüssel nicht gesperrt werden.

Gruß
bdmvg
Member: Reaper911211
Reaper911211 Apr 19, 2023 at 06:30:52 (UTC)
Goto Top
Zitat von @beidermachtvongreyscull:

Moin,

Du kannst nach meinem Kenntnisstand in Abhängigkeit zur verwendeten TK-Anlage(nsoftware) das durchaus auch selbst einstellen. Es wäre aber interessant zu erfahren, welche TK-Anlagenlösung bei Euch im Einsatz ist.

Bei SwyxIt und Netphone geht das durchaus, wenn die Registryschlüssel nicht gesperrt werden.

Gruß
bdmvg

wir nutzen die Telefonie Software Avaya. und die Settings werden direkt in der GPO vorgegeben eshalb ich da nen separaten eingriff machen will da man es ja auch manuell umstellen kann.
Member: beidermachtvongreyscull
beidermachtvongreyscull Apr 19, 2023 at 07:59:28 (UTC)
Goto Top
Zitat von @Reaper911211:

Zitat von @beidermachtvongreyscull:

Moin,

Du kannst nach meinem Kenntnisstand in Abhängigkeit zur verwendeten TK-Anlage(nsoftware) das durchaus auch selbst einstellen. Es wäre aber interessant zu erfahren, welche TK-Anlagenlösung bei Euch im Einsatz ist.

Bei SwyxIt und Netphone geht das durchaus, wenn die Registryschlüssel nicht gesperrt werden.

Gruß
bdmvg

wir nutzen die Telefonie Software Avaya. und die Settings werden direkt in der GPO vorgegeben eshalb ich da nen separaten eingriff machen will da man es ja auch manuell umstellen kann.

Wird wahrscheinlich nicht gehen.
Sofern ich das richtig vermute, verwendet man bei Euch Settings files, die über einen zentralen Pfad ausgerollt werden, der in diesem Schlüssel wohl konfiguriert wird:

HKEY_LOCAL_MACHINE\SOFTWARE\WOW6432Node\Avaya\Avaya IX Workplace\AutoconfigPath

Da das im Maschinenschlüssel abgefertigt wird, hast Du da nur Leserechte. Wird wohl nicht funktionieren, ohne Admin.
Member: colinardo
Solution colinardo Apr 19, 2023, updated at Apr 28, 2023 at 14:45:00 (UTC)
Goto Top
Servus.
Powershell:
<#
    Set  recording level of default recording device
#>
function Set-RecordingInputLevel {
    [cmdletbinding(SupportsShouldProcess=$true)]
    param(
        # recording level in percent(%) / valid range: 0-100%
        [parameter(mandatory=$false,ParameterSetName='SetVolume')][ValidateRange(0,100)][int]$level,  
        [parameter(mandatory=$false,ParameterSetName='Mute')][switch]$mute,  
        [parameter(mandatory=$false,ParameterSetName='Unmute')][switch]$unmute  
    )
    $ErrorActionPreference = 'Stop'  
    # add low level audio functions
    Add-Type @'  
        using System;
        using System.Runtime.InteropServices;

        namespace Audio {
            public class Controller {

                public static void SetDefaultCaptureDeviceVolume(float level){
                    IAudioEndpointVolume endpoint = null;
                    try{
                        endpoint = GetDefaultCaptureDevice();
                        if (endpoint == null){
                            throw new Exception("Error, no capture device found.");  
                        }
                        int hresult = endpoint.SetMasterVolumeLevelScalar(level/100, Guid.Empty);
                        if (hresult != 0){
                            if (hresult == -2147024809){
                                throw new ArgumentException(@"Invalid Argument. Valid values between 0-100!");  
                            }else{
                                throw new ArgumentException("Error: " + hresult.ToString());  
                            }
                        }
                    }catch (System.Exception ex){
                        System.Console.WriteLine("Exception: " + ex.Message);  
                    }finally{
                        if (endpoint != null)
                            Marshal.ReleaseComObject(endpoint);
                    }
                }
        
                public static void SetDefaultCaptureDeviceMute(bool mute){
                    IAudioEndpointVolume endpoint = null;
                    try{
                        endpoint = GetDefaultCaptureDevice();
                        if (endpoint == null){
                            throw new Exception("Error, no capture device found.");  
                        }
                        endpoint.SetMute(mute, Guid.Empty);
                    }finally{
                        if (endpoint != null)
                            Marshal.ReleaseComObject(endpoint);
                    }
                }

                private static IAudioEndpointVolume GetDefaultCaptureDevice(){
                    IMMDeviceEnumerator deviceEnumerator = null;
                    IMMDevice micro = null;
                    IAudioEndpointVolume masterVol = null;
                    try{
                        deviceEnumerator = (IMMDeviceEnumerator) (new MMDeviceEnumerator());
                        deviceEnumerator.GetDefaultAudioEndpoint(EDataFlow.eCapture, ERole.eMultimedia, out micro);
                        Guid IID_IAudioEndpointVolume = typeof (IAudioEndpointVolume).GUID;
                        object endpoint;
                        micro.Activate(ref IID_IAudioEndpointVolume, 0, IntPtr.Zero, out endpoint);
                        masterVol = (IAudioEndpointVolume) endpoint;
                        return masterVol;
                    }finally{
                        if (micro != null) Marshal.ReleaseComObject(micro);
                        if (deviceEnumerator != null) Marshal.ReleaseComObject(deviceEnumerator);
                    }
                }

                [ComImport]
                [Guid("BCDE0395-E52F-467C-8E3D-C4579291692E")]  
                internal class MMDeviceEnumerator{}

                internal enum EDataFlow {
                    eRender,
                    eCapture,
                    eAll,
                    EDataFlow_enum_count
                }

                internal enum ERole {
                    eConsole,
                    eMultimedia,
                    eCommunications,
                    ERole_enum_count
                }

                [Guid("A95664D2-9614-4F35-A746-DE8DB63617E6"), InterfaceType(ComInterfaceType.InterfaceIsIUnknown)]  
                internal interface IMMDeviceEnumerator {
                    int NotImpl1();

                    [PreserveSig]
                    int GetDefaultAudioEndpoint(EDataFlow dataFlow, ERole role, out IMMDevice ppDevice);
                }

                [Guid("D666063F-1587-4E43-81F1-B948E807363F"), InterfaceType(ComInterfaceType.InterfaceIsIUnknown)]  
                internal interface IMMDevice {
                    [PreserveSig]
                    int Activate(ref Guid iid, int dwClsCtx, IntPtr pActivationParams, [MarshalAs(UnmanagedType.IUnknown)] out object ppInterface);
                }

                [Guid("5CDF2C82-841E-4546-9722-0CF74078229A"),InterfaceType(ComInterfaceType.InterfaceIsIUnknown)]  
                public interface IAudioEndpointVolume {
                    [PreserveSig]
                    int NotImpl1();

                    [PreserveSig]
                    int NotImpl2();

                    /// <summary>
                    /// Gets a count of the channels in the audio stream.
                    /// </summary>
                    /// <param name="channelCount">The number of channels.</param>  
                    /// <returns>An HRESULT code indicating whether the operation passed of failed.</returns>
                    [PreserveSig]
                    int GetChannelCount(
                        [Out] [MarshalAs(UnmanagedType.U4)] out UInt32 channelCount);

                    /// <summary>
                    /// Sets the master volume level of the audio stream, in decibels.
                    /// </summary>
                    /// <param name="level">The new master volume level in decibels.</param>  
                    /// <param name="eventContext">A user context value that is passed to the notification callback.</param>  
                    /// <returns>An HRESULT code indicating whether the operation passed of failed.</returns>
                    [PreserveSig]
                    int SetMasterVolumeLevel(
                        [In] [MarshalAs(UnmanagedType.R4)] float level,
                        [In] [MarshalAs(UnmanagedType.LPStruct)] Guid eventContext);

                    /// <summary>
                    /// Sets the master volume level, expressed as a normalized, audio-tapered value.
                    /// </summary>
                    /// <param name="level">The new master volume level expressed as a normalized value between 0.0 and 1.0.</param>  
                    /// <param name="eventContext">A user context value that is passed to the notification callback.</param>  
                    /// <returns>An HRESULT code indicating whether the operation passed of failed.</returns>
                    [PreserveSig]
                    int SetMasterVolumeLevelScalar(
                        [In] [MarshalAs(UnmanagedType.R4)] float level,
                        [In] [MarshalAs(UnmanagedType.LPStruct)] Guid eventContext);

                    /// <summary>
                    /// Gets the master volume level of the audio stream, in decibels.
                    /// </summary>
                    /// <param name="level">The volume level in decibels.</param>  
                    /// <returns>An HRESULT code indicating whether the operation passed of failed.</returns>
                    [PreserveSig]
                    int GetMasterVolumeLevel(
                        [Out] [MarshalAs(UnmanagedType.R4)] out float level);

                    /// <summary>
                    /// Gets the master volume level, expressed as a normalized, audio-tapered value.
                    /// </summary>
                    /// <param name="level">The volume level expressed as a normalized value between 0.0 and 1.0.</param>  
                    /// <returns>An HRESULT code indicating whether the operation passed of failed.</returns>
                    [PreserveSig]
                    int GetMasterVolumeLevelScalar(
                        [Out] [MarshalAs(UnmanagedType.R4)] out float level);

                    /// <summary>
                    /// Sets the volume level, in decibels, of the specified channel of the audio stream.
                    /// </summary>
                    /// <param name="channelNumber">The channel number.</param>  
                    /// <param name="level">The new volume level in decibels.</param>  
                    /// <param name="eventContext">A user context value that is passed to the notification callback.</param>  
                    /// <returns>An HRESULT code indicating whether the operation passed of failed.</returns>
                    [PreserveSig]
                    int SetChannelVolumeLevel(
                        [In] [MarshalAs(UnmanagedType.U4)] UInt32 channelNumber,
                        [In] [MarshalAs(UnmanagedType.R4)] float level,
                        [In] [MarshalAs(UnmanagedType.LPStruct)] Guid eventContext);

                    /// <summary>
                    /// Sets the normalized, audio-tapered volume level of the specified channel in the audio stream.
                    /// </summary>
                    /// <param name="channelNumber">The channel number.</param>  
                    /// <param name="level">The new master volume level expressed as a normalized value between 0.0 and 1.0.</param>  
                    /// <param name="eventContext">A user context value that is passed to the notification callback.</param>  
                    /// <returns>An HRESULT code indicating whether the operation passed of failed.</returns>
                    [PreserveSig]
                    int SetChannelVolumeLevelScalar(
                        [In] [MarshalAs(UnmanagedType.U4)] UInt32 channelNumber,
                        [In] [MarshalAs(UnmanagedType.R4)] float level,
                        [In] [MarshalAs(UnmanagedType.LPStruct)] Guid eventContext);

                    /// <summary>
                    /// Gets the volume level, in decibels, of the specified channel in the audio stream.
                    /// </summary>
                    /// <param name="channelNumber">The zero-based channel number.</param>  
		            /// <param name="level">The volume level in decibels.</param>  
                    /// <returns>An HRESULT code indicating whether the operation passed of failed.</returns>
                    [PreserveSig]
                    int GetChannelVolumeLevel(
                        [In] [MarshalAs(UnmanagedType.U4)] UInt32 channelNumber,
                        [Out] [MarshalAs(UnmanagedType.R4)] out float level);

                    /// <summary>
                    /// Gets the normalized, audio-tapered volume level of the specified channel of the audio stream.
                    /// </summary>
                    /// <param name="channelNumber">The zero-based channel number.</param>  
		            /// <param name="level">The volume level expressed as a normalized value between 0.0 and 1.0.</param>  
                    /// <returns>An HRESULT code indicating whether the operation passed of failed.</returns>
                    [PreserveSig]
                    int GetChannelVolumeLevelScalar(
                        [In] [MarshalAs(UnmanagedType.U4)] UInt32 channelNumber,
                        [Out] [MarshalAs(UnmanagedType.R4)] out float level);

                    /// <summary>
                    /// Sets the muting state of the audio stream.
                    /// </summary>
                    /// <param name="isMuted">True to mute the stream, or false to unmute the stream.</param>  
                    /// <param name="eventContext">A user context value that is passed to the notification callback.</param>  
                    /// <returns>An HRESULT code indicating whether the operation passed of failed.</returns>
                    [PreserveSig]
                    int SetMute(
                        [In] [MarshalAs(UnmanagedType.Bool)] Boolean isMuted,
                        [In] [MarshalAs(UnmanagedType.LPStruct)] Guid eventContext);

                    /// <summary>
                    /// Gets the muting state of the audio stream.
                    /// </summary>
                    /// <param name="isMuted">The muting state. True if the stream is muted, false otherwise.</param>  
                    /// <returns>An HRESULT code indicating whether the operation passed of failed.</returns>
                    [PreserveSig]
                    int GetMute(
                        [Out] [MarshalAs(UnmanagedType.Bool)] out Boolean isMuted);

                    /// <summary>
                    /// Gets information about the current step in the volume range.
                    /// </summary>
                    /// <param name="step">The current zero-based step index.</param>  
                    /// <param name="stepCount">The total number of steps in the volume range.</param>  
                    /// <returns>An HRESULT code indicating whether the operation passed of failed.</returns>
                    [PreserveSig]
                    int GetVolumeStepInfo(
                        [Out] [MarshalAs(UnmanagedType.U4)] out UInt32 step,
                        [Out] [MarshalAs(UnmanagedType.U4)] out UInt32 stepCount);

                    /// <summary>
                    /// Increases the volume level by one step.
                    /// </summary>
                    /// <param name="eventContext">A user context value that is passed to the notification callback.</param>  
                    /// <returns>An HRESULT code indicating whether the operation passed of failed.</returns>
                    [PreserveSig]
                    int VolumeStepUp(
                        [In] [MarshalAs(UnmanagedType.LPStruct)] Guid eventContext);

                    /// <summary>
                    /// Decreases the volume level by one step.
                    /// </summary>
                    /// <param name="eventContext">A user context value that is passed to the notification callback.</param>  
                    /// <returns>An HRESULT code indicating whether the operation passed of failed.</returns>
                    [PreserveSig]
                    int VolumeStepDown(
                        [In] [MarshalAs(UnmanagedType.LPStruct)] Guid eventContext);

                    /// <summary>
                    /// Queries the audio endpoint device for its hardware-supported functions.
                    /// </summary>
                    /// <param name="hardwareSupportMask">A hardware support mask that indicates the capabilities of the endpoint.</param>  
                    /// <returns>An HRESULT code indicating whether the operation passed of failed.</returns>
                    [PreserveSig]
                    int QueryHardwareSupport(
                        [Out] [MarshalAs(UnmanagedType.U4)] out UInt32 hardwareSupportMask);

                    /// <summary>
                    /// Gets the volume range of the audio stream, in decibels.
                    /// </summary>
		            /// <param name="volumeMin">The minimum volume level in decibels.</param>  
		            /// <param name="volumeMax">The maximum volume level in decibels.</param>  
		            /// <param name="volumeStep">The volume increment level in decibels.</param>  
                    /// <returns>An HRESULT code indicating whether the operation passed of failed.</returns>
                    [PreserveSig]
                    int GetVolumeRange(
                        [Out] [MarshalAs(UnmanagedType.R4)] out float volumeMin,
                        [Out] [MarshalAs(UnmanagedType.R4)] out float volumeMax,
                        [Out] [MarshalAs(UnmanagedType.R4)] out float volumeStep);
                }
            }
        }
'@  

    switch($PSCmdlet.ParameterSetName){
        'SetVolume' {  
            if ($PSCmdlet.ShouldProcess($device.FriendlyName,"Set recording volume to $level%")){  
                # set recording level
                [Audio.Controller]::SetDefaultCaptureDeviceVolume($level)
            }
        }
        'Mute' {  
            if ($PSCmdlet.ShouldProcess($device.FriendlyName,"Mute device")){  
                [Audio.Controller]::SetDefaultCaptureDeviceMute($true)
            }
        }
        'Unmute' {  
            if ($PSCmdlet.ShouldProcess($device.FriendlyName,"Unmute device")){  
                # unmute
                [Audio.Controller]::SetDefaultCaptureDeviceMute($false)
            }
        }
    }
}
Kann dann wie folgt genutzt werden um bspw. das Recording-Level auf 60% zu setzen:
Set-RecordingInputLevel -level 60 -verbose
Muten und Unmuten lässt sich damit auch
Set-RecordingInputLevel -mute
Set-RecordingInputLevel -unmute

Grüße Uwe