Re: Devices on remote machines
- From: Mikecl <Mikecl@xxxxxxxxxxxxxxxxxxxxxxxxx>
- Date: Thu, 27 Dec 2007 01:51:02 -0800
Hi,
Thanks for responding I have copied two scripts both work locally neither
works remotely.
Thanks Mike
================================
If WScript.Arguments.Count = 0 Then
WScript.Echo "You must enter the computer name when starting this script."
WScript.Quit
End If
strComputer = WScript.Arguments.Item(0)
'WScript.Echo strComputer
' =====================================================================
' Insert your code here
' =====================================================================
Set objWMIService = GetObject("winmgmts:\\" & strComputer & "\root\cimv2")
Set colPrinters = objWMIService.ExecQuery("Select * From Win32_Printer")
For Each objPrinter In colPrinters
If objPrinter.Attributes And 64 Then
strPrinterType = "Local"
Else
strPrinterType = "Network"
End If
WScript.Echo objPrinter.Name & " -- " & strPrinterType
Next
==============================================
CompName = inputbox("enter computer name")
Set Connect = GetObject("WinNT://"&CompName)
Set WshNetwork = WScript.CreateObject("WScript.Network")
Set oDrives = WshNetwork.EnumNetworkDrives
Set oPrinters = WshNetwork.EnumPrinterConnections
WScript.Echo "Network drive mappings:"
For i = 0 to oDrives.Count - 1 Step 2
WScript.Echo "Drive " & oDrives.Item(i) & " = " & oDrives.Item(i+1)
Next
WScript.Echo
WScript.Echo "Network printer mappings:"
For i = 0 to oPrinters.Count - 1 Step 2
WScript.Echo "Port " & oPrinters.Item(i) & " = " & oPrinters.Item(i+1)
Next
"TDM" wrote:
.
"Mikecl" <Mikecl@xxxxxxxxxxxxxxxxxxxxxxxxx> wrote in message
news:EFCACFDC-FEF0-4451-9C14-0C5E703C106E@xxxxxxxxxxxxxxxx
Hi,
Thanks for responding, although I have full rights ont the remote machine
I
cant retrieve any usefull info I get two Printers Document Writer related
but
no networked printers nor can I retrieve mapped drive info from the local
machine I cant' get any info from remote machines even though I know they
have both mapped drives & network printers connected to their machine.
Thanks
"TDM" wrote:
Care to share your code ? I enumerate both mapped drives and printers
on remote systems for a data migration script that I use, and as long as
you have admin rights on the remote system, and a user is logged in on the
system, and WMI works on both systems(I do a wmi test first), then you
should have no problem getting the info. I would share my code, but it is
not designed to be stanadlone, I basically have 2 functions, one for
printers.
one for drives. Each function fills an array with the objects found. If you
think it might help, I would be glad to share it, but there are tons of
examples
already in google.
http://groups.google.com/groups/search?q=wmi+enumerate+printers&qt_s=Search+Groups
TDM
- Follow-Ups:
- Re: Devices on remote machines
- From: TDM
- Re: Devices on remote machines
- References:
- Re: Devices on remote machines
- From: TDM
- Re: Devices on remote machines
- From: Mikecl
- Re: Devices on remote machines
- From: TDM
- Re: Devices on remote machines
- Prev by Date: Re: Issue with WMI performance counters
- Next by Date: Re: GetDriveName creates accidental file
- Previous by thread: Re: Devices on remote machines
- Next by thread: Re: Devices on remote machines
- Index(es):
Relevant Pages
|