yllw98stng Posted February 27, 2006 Posted February 27, 2006 When we setup up new computers in our multi-site location, we currently have the individual we are setting up the computer for, tell us, over the phone, a list of all the printer (local and network) that they currently have installed on their computer. We do the same thing with their network/mapped drives. We can access their c:\ drive remotely. My question is, are these two things stored in a file somewhere that we could just pull up and see the information?Thanks,JasonTitle Edited - Please follow new posting rules from now on.--Zxian
cluberti Posted February 27, 2006 Posted February 27, 2006 For printers:On Error Resume NextConst wbemFlagReturnImmediately = &h10Const wbemFlagForwardOnly = &h20arrComputers = Array("<computer names here, comma-delimited>")For Each strComputer In arrComputers WScript.Echo WScript.Echo "==========================================" WScript.Echo "Computer: " & strComputer WScript.Echo "==========================================" Set objWMIService = GetObject("winmgmts:\\" & strComputer & "\root\CIMV2") Set colItems = objWMIService.ExecQuery("SELECT * FROM Win32_Printer", "WQL", _ wbemFlagReturnImmediately + wbemFlagForwardOnly) For Each objItem In colItems WScript.Echo "Name: " & objItem.Name WScript.Echo "ServerName: " & objItem.ServerName WScript.Echo "ShareName: " & objItem.ShareName WScript.Echo WScript.Echo "DriverName: " & objItem.DriverName WScript.Echo WScript.Echo "Location: " & objItem.Location WScript.Echo WScript.Echo "Comment: " & objItem.Comment NextNextFunction WMIDateStringToDate(dtmDate)WScript.Echo dtm: WMIDateStringToDate = CDate(Mid(dtmDate, 5, 2) & "/" & _ Mid(dtmDate, 7, 2) & "/" & Left(dtmDate, 4) _ & " " & Mid (dtmDate, 9, 2) & ":" & Mid(dtmDate, 11, 2) & ":" & Mid(dtmDate,13, 2))End FunctionFor mapped drives:On Error Resume NextConst wbemFlagReturnImmediately = &h10Const wbemFlagForwardOnly = &h20arrComputers = Array("<computer names here, comma-delimited>")For Each strComputer In arrComputers WScript.Echo WScript.Echo "==========================================" WScript.Echo "Computer: " & strComputer WScript.Echo "==========================================" Set objWMIService = GetObject("winmgmts:\\" & strComputer & "\root\CIMV2") Set colItems = objWMIService.ExecQuery("SELECT * FROM Win32_MappedLogicalDisk", "WQL", _ wbemFlagReturnImmediately + wbemFlagForwardOnly) For Each objItem In colItems WScript.Echo "ProviderName: " & objItem.ProviderName WScript.Echo "FileSystem: " & objItem.FileSystem WScript.Echo NextNextFunction WMIDateStringToDate(dtmDate)WScript.Echo dtm: WMIDateStringToDate = CDate(Mid(dtmDate, 5, 2) & "/" & _ Mid(dtmDate, 7, 2) & "/" & Left(dtmDate, 4) _ & " " & Mid (dtmDate, 9, 2) & ":" & Mid(dtmDate, 11, 2) & ":" & Mid(dtmDate,13, 2))End Function
yllw98stng Posted February 27, 2006 Author Posted February 27, 2006 Sorry, I am a little dumb. How do I run these scripts?
CptMurphy Posted February 27, 2006 Posted February 27, 2006 You have to compile them in a vb compiler.
<SparTacuS> Posted February 27, 2006 Posted February 27, 2006 In the past I have used a "Printer Migration" tool (from MS) to backup and restore printer settings. I cannot find my copy ATM but here is a link to the download (I'm almost certain that I used this version)Print Migrator
cluberti Posted February 27, 2006 Posted February 27, 2006 Just copy them into a new text file, and rename them to .vbs - then open a command prompt and run. No need for a compiler.Also, printmig may work but it's a crapshoot against remote systems - stick to the vbscripts, they work 100% of the time.
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now