Partager via


Désactiver le Panneau de configuration hérité (CSCP)

Après le lancement de New Panneau de configuration, à partir de Skype Entreprise Server build 2019 2046.524, nous ajoutons la prise en charge de deux nouvelles clés de Registre qui, lorsqu’elles sont présentes, valident l’entrée et désactivent la Panneau de configuration d’origine (CSCP) dans le menu d’options de lancement.

SOFTWARE\Microsoft\Real-Time Communications{5DC8C4D5-5133-4CE5-BF4E-8C459BF419D6}\DMR : Ajoute la validation pour le serveur de surveillance

SOFTWARE\Microsoft\Real-Time Communications{5DC8C4D5-5133-4CE5-BF4E-8C459BF419D6}\OCP : Clé de Registre pour désactiver le Panneau de configuration d’origine (CSCP)

Remarque

Si les clés de Registre ne sont pas présentes, aucune modification n’est apportée au comportement de lancement Panneau de configuration.

Le script PowerShell suivant ajoute les deux nouvelles clés de Registre :

[CmdletBinding()]
param (
    [switch]$Undo
)

# IIS site details
$iisSiteName = "Skype for Business Server Internal Web Site"
$iisAppName = "cscp"
$iisAppPhysicalPathOld = "C:\Program Files\Skype for Business Server 2019\Web Components\AdminUI"
$iisAppPhysicalPath = "C:\Program Files\Skype for Business Server 2019\Web Components"

# Load the WebAdministration module
Import-Module WebAdministration

if ($Undo) {
    # Undo the changes made by the script
    $parentKey = "HKLM:\SOFTWARE\Microsoft\Real-Time Communications\{5DC8C4D5-5133-4CE5-BF4E-8C459BF419D6}"
    $registryKeys = @("DMR", "OCP")

    foreach ($key in $registryKeys) {
        $registryKey = "$parentKey\$key"
        # Check if the key exists before removing it
        if (Test-Path $registryKey) {
            Remove-Item -Path $registryKey -Recurse -Force
            Write-Host "Registry key '$registryKey' removed."
        } else {
            Write-Host "Registry key '$registryKey' does not exist. No changes were made."
        }
    }

     # IIS application changes
    # Check if the IIS site exists
    if ($iisSite = Get-Website $iisSiteName -ErrorAction SilentlyContinue) {
        # Check if the application exists
        $existingApp = Get-WebApplication -Site $iisSiteName | Where-Object { $_.Path -eq "/$iisAppName" }
        if ($existingApp) {
            # If the application exists, change the Physical Path using Set-WebConfigurationProperty
            Set-WebConfigurationProperty -Filter "/system.applicationHost/sites/site[@name='$iisSiteName']/application[@path='/$iisAppName']/virtualDirectory[@path='/']" -Name "physicalPath" -Value $iisAppPhysicalPathOld
            Write-Host "IIS application '$iisAppName' Physical Path changed to '$iisAppPhysicalPathOld'."
        } else {
            Write-Host "IIS application '$iisAppName' does not exist. The Physical Path cannot be changed."
        }
    } else {
        Write-Host "IIS site '$iisSiteName' does not exist. The application cannot be changed."
    }
}
else {
    # Apply the changes

    # Registry changes
    $parentKey = "HKLM:\SOFTWARE\Microsoft\Real-Time Communications\{5DC8C4D5-5133-4CE5-BF4E-8C459BF419D6}"
    $registryKeys = @("DMR", "OCP")

    foreach ($key in $registryKeys) {
        $registryKey = "$parentKey\$key"
        # Check if the key exists
        if (-Not (Test-Path $registryKey)) {
            # If the key does not exist, create it with a default value or add any necessary subkeys or values
            New-Item -Path $registryKey -Force | Out-Null
            Write-Host "Registry key '$registryKey' and values created."
        } else {
            Write-Host "Registry key '$registryKey' already exists."
        }
    }

    # IIS application changes
    # Check if the IIS site exists
    if ($iisSite = Get-Website $iisSiteName -ErrorAction SilentlyContinue) {
        # Check if the application exists
        $existingApp = Get-WebApplication -Site $iisSiteName | Where-Object { $_.Path -eq "/$iisAppName" }
        if ($existingApp) {
            # If the application exists, change the Physical Path using Set-WebConfigurationProperty
            Set-WebConfigurationProperty -Filter "/system.applicationHost/sites/site[@name='$iisSiteName']/application[@path='/$iisAppName']/virtualDirectory[@path='/']" -Name "physicalPath" -Value $iisAppPhysicalPath
            Write-Host "IIS application '$iisAppName' Physical Path changed to '$iisAppPhysicalPath'."
        } else {
            Write-Host "IIS application '$iisAppName' does not exist. The Physical Path cannot be changed."
        }
    } else {
        Write-Host "IIS site '$iisSiteName' does not exist. The application cannot be changed."
    }
}

Write-Host "Restarting IIS Server"
# Perform IIS reset
iisreset
Write-Host "Done"

Remarque

Si vous avez accidentellement exécuté le script ci-dessus et que vous souhaitez annuler les modifications, exécutez le script PowerShell ci-dessus avec -Undo le paramètre .