Script Audit.vbs work perfectly. Show me all i need. In my network i' distribute printers with gpp for user. Every user see printers published by GPP es: \\printerserver\xerox 5775. The script audit show only local printer and network printer. how i can do to modify the audit.vbs to show me \\printerserver\xerox 5775 ? I' ve a script vbs that list all the printers how i want, this script list printers and create a file text .This is the code: ---------------------------------------------------------------------------------------------------------- Const ForAppending = 8 Const ForReading = 1
Dim WshNetwork, objPrinter, intDrive, intNetLetter
strComputer = inputbox("Please enter the computer name or IP address.","Computer Name",".")
Set WshNetwork = CreateObject("WScript.Network") Set objWMIService = GetObject("winmgmts:{impersonationLevel=impersonate}!\\" & strComputer & "\root\cimv2") Set colInstalledPrinters = objWMIService.ExecQuery("Select * from Win32_Printer") Set colItems = objWMIService.ExecQuery("Select * from Win32_ComputerSystem",,48) Set WshShell = WScript.CreateObject("WScript.Shell") Set objFSO = CreateObject("Scripting.FileSystemObject")
For Each objItem in colItems UserName = objItem.UserName arrUserName = Split(UserName, "\", -1, 1) varUserName = arrUserName(1) Next
filOutput = varUserName & ".txt"
If objFSO.FileExists(filOutput) Then objFSO.DeleteFile(filOutput) End If
Set objOutputFile = objFSO.OpenTextFile (filOutput, ForAppending, True) For Each objPrinter in colInstalledPrinters strTest = Left(objPrinter.Name, 2) objOutputFile.WriteLine(objPrinter.Name) Next 'objOutputFile.Close
'added Set objPrinter = WshNetwork.EnumPrinterConnections 'Set objOutputFile = objFSO.OpenTextFile (filOutput, ForAppending, True) If objPrinter.Count = 0 Then WScript.Echo "No Printers Mapped " else For intDrive = 0 To (objPrinter.Count -1) Step 2 intNetLetter = IntNetLetter +1 printer = "UNC Path " & objPrinter.Item(intDrive) & " = " & objPrinter.Item(intDrive +1) & " Printer : " & intDrive objOutputFile.WriteLine(printer) Next end if objOutputFile.Close 'added
varOpen = MsgBox("Do you want to view the printers?",36,"View File?") If varOpen = vbYes Then varCommand = "notepad " & filOutput WshShell.Run varCommand,1,False End If
Wscript.Sleep 1500 MsgBox "Printer mappings have been stored in '" & filOutput & "'.", 64, "Script Complete" Wscript.Quit ----------------------------------------------------------------------------------- Please Someone can help me?
Thanks Frank
|