Re: Devices on remote machines



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


.



Relevant Pages

  • Executing a vbscript under another users context
    ... I would like to run a script that queries current mapped drives in a remote ... machines -the script queries the logged on user and then pulls the mapped ...
    (microsoft.public.scripting.wsh)
  • Re: Remote office logon script - Long Delay
    ... Windows IP Configuration ... If I point the User's profile to a script that doesn't contain the ... I do not have WINS configured for the remote site, ... This remote server was built using connect computer script, ...
    (microsoft.public.windows.server.sbs)
  • Re: Remote office logon script - Long Delay
    ... Windows IP Configuration ... If I point the User's profile to a script that doesn't contain the ... I do not have WINS configured for the remote site, ... This remote server was built using connect computer script, ...
    (microsoft.public.windows.server.sbs)
  • RE: WMI ExecQuery from Win32_NTEventLogFile in a Workgroup environ
    ... computer from which the script is being run? ... "urkec" wrote: ... as it correctly creates the .evt files for the local ... I have a script that runs on one node and copies files from all the remote ...
    (microsoft.public.scripting.vbscript)
  • Re: AddPrinterConnection failing to add network printer to remote pc
    ... the remote machine so you are stuck in the same place. ... I have managed to write the code to add the network printer and it ... I can manually install the network printer on the test pc via the ... If I specifiy the ip address of the test pc in the ManagementScope ...
    (microsoft.public.windowsxp.print_fax)

Quantcast