diff --git a/LabelPrinting.cs b/LabelPrinting.cs index cb6af6a..bd8476f 100644 --- a/LabelPrinting.cs +++ b/LabelPrinting.cs @@ -18,6 +18,10 @@ public static void printLabel(Grid grid) PSInterface.RunPowershell($"If (-NOT (Test-Path '{RPCPath}')) {{ New-Item -Path '{RPCPath}' -Force | Out-Null}}"); PSInterface.RunPowershell($"New-ItemProperty -Path '{RPCPath}' -Name 'RpcUseNamedPipeProtocol' -Value 1 -PropertyType DWORD"); + // Workaround for W11 24H2 + PSInterface.RunPowershell("Set-SmbClientConfiguration -EnableInsecureGuestLogons $true -Force"); + PSInterface.RunPowershell("Set-SmbClientConfiguration -RequireSecuritySignature $false -Force"); + // Add printer PSInterface.RunPowershell($"Add-Printer -ConnectionName \"\\\\{SettingsHandler.ReadSettings().printerHost}\\{SettingsHandler.ReadSettings().printerShareName}"); @@ -80,6 +84,10 @@ public static void printLabel(Grid grid) // Unset RPC over remote pipes PSInterface.RunPowershell($"New-ItemProperty -Path '{RPCPath}' -Name 'RpcUseNamedPipeProtocol' -Value 0 -PropertyType DWORD"); + // Reverse 24H2 workaround + PSInterface.RunPowershell("Set-SmbClientConfiguration -EnableInsecureGuestLogons $false -Force"); + PSInterface.RunPowershell("Set-SmbClientConfiguration -RequireSecuritySignature $true -Force"); + // Add printer event using (var db = new ComputerSystemContext()) {