Photo Gallery Member List Search Calendars FAQ Ticket List Log Out


Remote network config...

 
Logged in as: Guest
arrSession:exec spGetSession 2,2,2418
 Active Users: There are 0 members and 0 guests.
 Users viewing this topic: none
 

 

 
  
  Printable Version
All Forums >> [Scripting] >> WSH & Client Side VBScript >> Remote network config...
  Do you like VisualBasicScript.com? Link to us and help spread the word about our forum. Thanks!
Page: [1]
Login
Message << Older Topic   Newer Topic >>
 Remote network config... - 3/21/2005 9:33:12 AM   
  robiee4u

 

Posts: 36
Score: 0
Joined: 10/6/2004
From:
Status: offline
Hi there, I am new in Scripting world.
is there any way of retrieving info from a remote machine i.e. shares, network drives, printers (such as we use net use/share etc for a local machine).
Basically, I am creating a web based trouble shooting tool for the helpdesk. Where they will input an IP address and then it will retrieve the appropriate info from a remote machine. Is there any object or method to these kind of functions?
 
 
Post #: 1
 
 Re: Remote network config... - 3/21/2005 9:45:04 AM   
  token

 

Posts: 1917
Score: 0
Joined: 1/14/2005
From:
Status: offline
net view always works =)

You can just run the above cmd from within vbs using the EXEC method of the SHELL object.

eg:

=======================================================================
Set shell = CreateObject("WScript.Shell")
set output = shell.Exec("net view \\remote_server")

Do Until output.stdout.atendofstream
temp = output.stdout.readline
WScript.Echo temp
Loop
=======================================================================

You can then decide on the information you wanted and prase them if necessary.

(in reply to robiee4u)
 
 
Post #: 2
 
 Re: Remote network config... - 3/21/2005 11:13:38 PM   
  robiee4u

 

Posts: 36
Score: 0
Joined: 10/6/2004
From:
Status: offline
thanx,
it shows only shared drives/files. But it doesn't show any mapped network drives or printers! Is there any ways to retrieve them remotely. Please help.

(in reply to robiee4u)
 
 
Post #: 3
 
 Re: Remote network config... - 3/22/2005 12:00:05 AM   
  mbouchard


Posts: 1916
Score: 16
Joined: 5/15/2003
From: USA
Status: offline
here is a script that will list all mapped drives, shared folders, and local printers.


      

(in reply to robiee4u)
 
 
Post #: 4
 
 Re: Remote network config... - 3/22/2005 2:30:00 AM   
  robiee4u

 

Posts: 36
Score: 0
Joined: 10/6/2004
From:
Status: offline
Thank you very much. This works fine for the first half but I am getting the same error i got before in a different script. Which is
C:\vbs\remoteShares.vbs(33, 1) (null): 0x80041010
And line 33 is
For Each objItem in colItems
I do not know why this error is occuring.

(in reply to robiee4u)
 
 
Post #: 5
 
 Re: Remote network config... - 3/22/2005 2:43:20 AM   
  mbouchard


Posts: 1916
Score: 16
Joined: 5/15/2003
From: USA
Status: offline
Is there an error description? Try commenting out the on error resume next. Also, what OS is the PC that you are receiving this error on?

(in reply to robiee4u)
 
 
Post #: 6
 
 Re: Remote network config... - 3/22/2005 2:54:35 AM   
  robiee4u

 

Posts: 36
Score: 0
Joined: 10/6/2004
From:
Status: offline
I did comment out the on error resume next otherwise it was just printing the "Share Info"
not the drive mapping info. I am using windows 2000 professional. There is no error description other then the one i posted before. I found some info on the error code. I couldnt find any spelling mistakes as well.
http://computerperformance.co.uk/Logon/code/code_80041010.htm

(in reply to robiee4u)
 
 
Post #: 7
 
 Re: Remote network config... - 3/22/2005 3:55:48 AM   
  token

 

Posts: 1917
Score: 0
Joined: 1/14/2005
From:
Status: offline
The Win32_MappedLogicalDisk class is supported only in XP on the client side.

You can try the CIM_LogicalDisk class, it is supported by XP and NT4. SO take your chances for 2000 =)

strComputer = "."
Set objWMIService = GetObject("winmgmts:{impersonationLevel=impersonate}!\\" & strComputer & "\root\cimv2")
Set colItems = objWMIService.ExecQuery("Select * from CIM_LogicalDisk")
For Each objItem in colItems
WScript.Echo "Access: " & objItem.Access
WScript.Echo "Availability: " & objItem.Availability
WScript.Echo "BlockSize: " & objItem.BlockSize
WScript.Echo "Caption: " & objItem.Caption
WScript.Echo "ConfigManagerErrorCode: " & objItem.ConfigManagerErrorCode
WScript.Echo "ConfigManagerUserConfig: " & objItem.ConfigManagerUserConfig
WScript.Echo "CreationClassName: " & objItem.CreationClassName
WScript.Echo "Description: " & objItem.Description
WScript.Echo "DeviceID: " & objItem.DeviceID
WScript.Echo "ErrorCleared: " & objItem.ErrorCleared
WScript.Echo "ErrorDescription: " & objItem.ErrorDescription
WScript.Echo "ErrorMethodology: " & objItem.ErrorMethodology
WScript.Echo "FreeSpace: " & objItem.FreeSpace
WScript.Echo "InstallDate: " & objItem.InstallDate
WScript.Echo "LastErrorCode: " & objItem.LastErrorCode
WScript.Echo "Name: " & objItem.Name
WScript.Echo "NumberOfBlocks: " & objItem.NumberOfBlocks
WScript.Echo "PNPDeviceID: " & objItem.PNPDeviceID
for each propValue in objItem.PowerManagementCapabilities
WScript.Echo "PowerManagementCapabilities: " & propValue
next
WScript.Echo "PowerManagementSupported: " & objItem.PowerManagementSupported
WScript.Echo "Purpose: " & objItem.Purpose
WScript.Echo "Size: " & objItem.Size
WScript.Echo "Status: " & objItem.Status
WScript.Echo "StatusInfo: " & objItem.StatusInfo
WScript.Echo "SystemCreationClassName: " & objItem.SystemCreationClassName
WScript.Echo "SystemName: " & objItem.SystemName
Next

(in reply to robiee4u)
 
 
Post #: 8
 
 Re: Remote network config... - 3/22/2005 5:47:58 AM   
  mbouchard


Posts: 1916
Score: 16
Joined: 5/15/2003
From: USA
Status: offline
Ahh, did not know that, thanks Token.

(in reply to robiee4u)
 
 
Post #: 9
 
 Re: Remote network config... - 3/22/2005 5:54:32 AM   
  token

 

Posts: 1917
Score: 0
Joined: 1/14/2005
From:
Status: offline
heh... I didn't know that either. =)


(in reply to robiee4u)
 
 
Post #: 10
 
 Re: Remote network config... - 3/22/2005 8:43:14 PM   
  robiee4u

 

Posts: 36
Score: 0
Joined: 10/6/2004
From:
Status: offline
Thanx guys,
I have used this and it works fine locally to my machine. But when I change the machine name to another remote machine in my network it shows an error message:
Permission denied:"GetObject"
Code:800A0046
Please let me know if you have any ideas of this error.
NB:I am a helpdesk admin (I can use psexec command to remote machine).

(in reply to robiee4u)
 
 
Post #: 11
 
 Re: Remote network config... - 3/23/2005 4:26:23 AM   
  token

 

Posts: 1917
Score: 0
Joined: 1/14/2005
From:
Status: offline
Whose script are you talking about here ? I though the problem was pretty self explainatory though. It didn't seem that you have the appropriate permission to GET the specific object in question (which I don't know what because you didn't tell us what exactly is the line that caused the error)

(in reply to robiee4u)
 
 
Post #: 12
 
 Re: Remote network config... - 4/28/2005 2:13:05 AM   
  MasterOfTheHat

 

Posts: 6
Score: 0
Joined: 4/4/2005
From:
Status: offline
mbouchard: you say that your script will list the local printers, too, but I don't see anything but the shares and mapped drives... Do you have any code to add that will list the printers, too?

(in reply to robiee4u)
 
 
Post #: 13
 
 
 
  

If you found our site useful please link to us <a href="http://www.visualbasicscript.com">VisualBasicScript.com</a>.
All Forums >> [Scripting] >> WSH & Client Side VBScript >> Remote network config... Page: [1]
Jump to:





New Messages No New Messages
Hot Topic w/ New Messages Hot Topic w/o New Messages
Locked w/ New Messages Locked w/o New Messages
 Post New Thread
 Reply to Message
 Post New Poll
 Submit Vote
 Delete My Own Post
 Delete My Own Thread
 Rate Posts