How To Fix Miracast for a Specific Device when the Firewall blocks All Public Connections

If you are attempting to Miracast from a device that has group policy on it that disables all public connection, the Miracast will fail. You can get around this by getting up a scheduled task.


First, create Task with custom XML Filtering with this filtering

<QueryList>
  <Query Id="0" Path="Microsoft-Windows-WLAN-AutoConfig/Operational">
    <Select Path="Microsoft-Windows-WLAN-AutoConfig/Operational">*[EventData[Data[@Name='SSID'] and (Data='SSID NAME')]]
</Select>
  </Query>
</QueryList>

The script that will run every time the above event happens will run this code:

$source = 'Miracast Wifi Direct Fix'
$WifiDirectSSIDName = "SSID Name"
New-EventLog -Logname Application -source $source -ErrorAction SilentlyContinue
(Get-ChildItem "HKLM:\SOFTWARE\Microsoft\Windows NT\CurrentVersion\NetworkList\Profiles") |
foreach{if (($PSItem).GetValue("ProfileName") -eq "$WifiDirectSSIDName")
    {$MiracastProfileRegistryPath = $PSItem.Name}
    }
$MiracastProfileRegistryPath = $MiracastProfileRegistryPath.Replace("HKEY_LOCAL_MACHINE","HKLM:")
if ((Get-ItemPropertyValue -Path $MiracastProfileRegistryPath -Name "Category") -ne "1")
    {
    Write-EventLog -Logname Application -source $source  -Entrytype Information -EventID 500 -Message "Changed $WifiDirectSSIDName Wifi Profile to Private"
    Set-ItemProperty -Path $MiracastProfileRegistryPath -Name "Category" -Value 1
    }

Comments

Popular posts from this blog

Application Doesn't Install During OSD Task Sequence in SCCM

SCCM PXE Boot Issues - No Advertisements Found

Outlook VBA Macros for Journal Entries