使用Powershell 统计Widnows打印服务器用户打印数量

发布时间:2020-07-05 11:16:35 作者:raincity
来源:网络 阅读:1091

公司的管理需求就是查看哪个员工打印的情况,解决方案:

第一,到Windows那台打印服务器,把打印日志启动。操作方法就是,打开Event Viewer,然后导航到Applications and Services Logs\Microsoft\windows\Print Service\Optional

在这个上面点右键,选择Enabled Log


使用Powershell 统计Widnows打印服务器用户打印数量


以上方法也可以通过Powershell语句来实现。


Get-WinEvent -ListLog Microsoft-Windows-PrintService/Operational -OutVariable PrinterLog |

Select-Object -Property LogName, IsClassicLog, IsEnabled

 

$PrinterLog.set_IsEnabled($true)

 

$PrinterLog.SaveChanges()

 

Get-WinEvent -ListLog Microsoft-Windows-PrintService/Operational -OutVariable PrinterLog |

Select-Object -Property LogName, IsClassicLog, IsEnabled


使用Powershell 统计Widnows打印服务器用户打印数量

先运行第一条命令,发现那个属性值未被启用,然后通过命令强制启用,再检查一下。



以下通过这个命令就能一下子得到答案。

Get-WinEvent -FilterHashTable @{LogName="Microsoft-Windows-PrintService/Operational"; ID=307; StartTime=(Get-Date).AddDays(-1)} |
Format-Table -Property TimeCreated,
                        @{label='UserName';expression={$_.properties[2].value}},
                        @{label='ComputerName';expression={$_.properties[3].value}},
                        @{label='PrinterName';expression={$_.properties[4].value}},
                        @{label='PrintSize';expression={$_.properties[6].value}},
                        @{label='Pages';expression={$_.properties[7].value}}




推荐阅读:
  1. 如何将USB接口打印机转换成RJ45网口并安装到打印服务器上共享使用?
  2. 如何安装和配置打印服务器之六:自定义客户端电脑使用网络打印机的默认设置

免责声明:本站发布的内容(图片、视频和文字)以原创、转载和分享为主,文章观点不代表本网站立场,如果涉及侵权请联系站长邮箱:is@yisu.com进行举报,并提供相关证据,一经查实,将立刻删除涉嫌侵权内容。

powershell ers

上一篇:非exchange下,outlook日历实时同步神器

下一篇:C# 绘制Word图形、组合图形

相关阅读

您好,登录后才能下订单哦!

密码登录
登录注册
其他方式登录
点击 登录注册 即表示同意《亿速云用户服务条款》