Connect to networkprinter and create a log file at printerserver
来源:互联网 发布:jenkins构建github源码 编辑:程序博客网 时间:2024/06/05 04:24
Set WshNetwork =WScript.CreateObject("WScript.Network")
WshNetwork.AddWindowsPrinterConnection "//PrinterServer/Ricoh1060"
WshNetwork.SetDefaultPrinter "//PrinterServer/Ricoh1060"
Set objWMIService = GetObject("winmgmts://" & WshNetwork.ComputerName& "/root/cimv2")
Set colItems = objWMIService.ExecQuery("Select * from Win32_Printer",,48)
Set fso = CreateObject("Scripting.FileSystemObject")
Set fsofile = fso.CreateTextFile("//PrinterServer/Script/PrintConnectLog/" & WshNetwork.ComputerName & ".txt", True)
For Each objItem in colItems
fsofile.WriteLine "DeviceID: " & objItem.DeviceID
Next
fsofile.Close
set fso=nothing
colItems.Close
set objWMIService=nothing
set WshNetwork=nothing
Wscript.quit
WshNetwork.AddWindowsPrinterConnection "//PrinterServer/Ricoh1060"
WshNetwork.SetDefaultPrinter "//PrinterServer/Ricoh1060"
Set objWMIService = GetObject("winmgmts://" & WshNetwork.ComputerName& "/root/cimv2")
Set colItems = objWMIService.ExecQuery("Select * from Win32_Printer",,48)
Set fso = CreateObject("Scripting.FileSystemObject")
Set fsofile = fso.CreateTextFile("//PrinterServer/Script/PrintConnectLog/" & WshNetwork.ComputerName & ".txt", True)
For Each objItem in colItems
fsofile.WriteLine "DeviceID: " & objItem.DeviceID
Next
fsofile.Close
set fso=nothing
colItems.Close
set objWMIService=nothing
set WshNetwork=nothing
Wscript.quit
- Connect to networkprinter and create a log file at printerserver
- file.alert - log alert to a file
- how to create a sln file
- How to create a PDF file, cheaply?
- How to Create a WordPress WXR File
- How to create a sysfs file node
- Linux tip - How to create a file and write by script?
- Unable to connect to a repository at URL
- SVN Unable to connect to a repository at URL
- SVN Unable to connect to a repository at URL
- Unable to connect to a repository at URL...
- svn: E175002: Unable to connect to a repository at URL
- svn Unable to connect to a repository at URL
- Unable to connect to a repository at URL
- TortoiseSVN Unable to connect to a repository at URL XXX
- svn: Unable to connect to a repository at URL eclipse
- svn: E160043: Unable to connect to a repository at URL
- SVN Unable to connect to a repository at URL问题解决
- 容器类作为全局成员不妥
- 写入Pdf
- JS判断浏览器类型
- Axure RP Pro - 相关问题 - 修改自定义样式对已应用该样式部件的逻辑
- Reset Internet Explorer Setting
- Connect to networkprinter and create a log file at printerserver
- C# 3.5 新特性的总结(一)
- Just one last dance最后一支舞
- Create a shortcut for a program at user Desktop
- Axure RP Pro - Wireframe线框 - 选择后面的部件
- Add Url To Favorites
- 利用shell脚本对游戏日志信息的提取
- 常用JavaScript收藏
- ClientDataSet使用方法