0

How do you disable 'Bidirectional communication' using powershell?

I can see EnableBIDI when running:

get-WmiObject -class Win32_printer | fl *

But when I try this, it says the property was not found?

Set-PrinterProperty -PrinterName "Some Printer" -PropertyName "EnableBIDI" -Value $False
Lance U. Matthews
  • 15,725
  • 6
  • 48
  • 68
Tsukasa
  • 6,342
  • 16
  • 64
  • 96
  • I've come across this issue with HP JetDirect before, the code isn't pure PowerShell as it's using printui.dll to make the change, but may well help you: `Invoke-Expression -command "rundll32 printui.dll,PrintUIEntry /Xs /n 'MyPrinterName' attributes -EnableBidi"` – henrycarteruk Feb 26 '18 at 16:19
  • The EnableBIDI property is Read/Write so you should be able to set it with the WMI object. – EBGreen Feb 26 '18 at 16:24
  • @JamesC. how do you specify the value when using attributes -EnableBidi – Tsukasa Feb 26 '18 at 16:27
  • Also, Set-PrinterProperty only sets certain properties. https://learn.microsoft.com/en-us/powershell/module/printmanagement/set-printerproperty?view=win10-ps – EBGreen Feb 26 '18 at 16:27

1 Answers1

1

You are mixing properties from two different WMI classes. Set-PrinterProperty manipulates instances of the undocumented MSFT_PrinterProperty class from the root/standardcimv2 namespace, which has different properties than the Win32_Printer class in your previous command.

Instead, manipulate the desired instance of the Win32_Printer class since that has the property you want, then call Put() to commit the change. This works for me when run with elevation:

$printer = Get-WmiObject -Class 'Win32_Printer' -Filter 'Name = ''My Printer Name'''
$printer.EnableBIDI = $false
$printer.Put()

Using the newer CimCmdlets module you can make that change in similar fashion using the Get-CimInstance and Set-CimInstance cmdlets...

$printer = Get-CimInstance -ClassName 'Win32_Printer' -Filter 'Name = ''My Printer Name'''
$printer.EnableBIDI = $false
Set-CimInstance -InputObject $printer

...or simplify it to a single pipeline...

Get-CimInstance -ClassName 'Win32_Printer' -Filter 'Name = ''My Printer Name''' `
    | Set-CimInstance -Property @{ EnableBIDI = $false }

...or even simplify it to a single cmdlet invocation...

Set-CimInstance -Query 'SELECT * FROM Win32_Printer WHERE Name = ''My Printer Name''' -Property @{ EnableBIDI = $false }
Lance U. Matthews
  • 15,725
  • 6
  • 48
  • 68