Are there enough entries in the win32_printer list to merit NEEDING to use
-filter? Yes, it is faster than a Where-Object, but I have less than 10
printers on my print server and I don't notice an execution difference.
Here's what I ran:

powershell.exe -executionpolicy bypass -command "& {Get-WmiObject
win32_printer | ? Portname -like '*.*.*.*' | select Name, PortName |
ConvertTo-Csv -NoTypeInformation | out-file
c:\temp\%Hostname%_printers.csv}"

And if using windows 7 with Posh v2:
powershell.exe -executionpolicy bypass -command "& {Get-WmiObject
win32_printer | ? {$_.Portname -like '*.*.*.*'} | select Name, PortName |
ConvertTo-Csv -NoTypeInformation | out-file
c:\temp\%Hostname%_printers.csv}"

That work for your needs?

Thanks,
Devin Rich
Systems Administrator

On Tue, Jun 6, 2017 at 9:11 AM, Daniel Ratliff <dratl...@humana.com> wrote:

> Any ideas on how to get around this? I have played around with the
> backtick, double quotes, single quotes, and cannot seem to find a working
> syntax. It is failing on the WMI filter.
>
>
>
> powershell.exe -executionpolicy bypass -command "& {Get-WmiObject
> win32_printer -Filter "PortName LIKE '%.%.%.%'" | select Name, PortName |
> ConvertTo-Csv -NoTypeInformation | out-file c:\temp\%Hostname%_printers.
> csv}"
>
>
>
>
>
> *Daniel Ratliff*
>
>
>
> The information transmitted is intended only for the person or entity to
> which it is addressed
> and may contain CONFIDENTIAL material. If you receive this
> material/information in error,
> please contact the sender and delete or destroy the material/information.
>
>

-- 
The information contained in this message is privileged, confidential, and 
protected from disclosure. If you are not the intended recipient, you are 
hereby notified that any review, printing, dissemination, distribution, 
copying or other use of this communication is strictly prohibited. If you 
have received this communication in error, please notify us immediately by 
replying to the message and deleting it from your computer.


Reply via email to