Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chriss Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Problems running a UNC command from a button 2

Status
Not open for further replies.

Modex

Programmer
Sep 15, 2002
155
GB
Hi all,

I have set up a small database that records details about a number of machines and would like to be able to jump to the C: drive of any selected machine. I tried doing this via this code, but nothing happens. Could anyone please help me.

Many thanks

ModeX

Private Sub Command124_Click()
On Error GoTo error1
Dim p1 As String
p1 = "\\" & [Server ID] & "\c$"
a = Shell(p1, vbNormalFocus)
GoTo end1
error1:

end1:

Also,
does anyone know of a way to fire up perfmon.exe for a remote machine by the same method. Bascially I would like to find a machine in the database and click a button to look at the performance of that machine

Thanks once again

ModeX
 
ModeX,
No answer on part 1, on part 2 try adding the Microsoft Management Console x.x as a reference to your database (Microdoft Visual Basic: Tools=>References, Microsoft Management Console x.x) this will allow you to create an istance of the MMC in code, call the ConnectTo method, then query/view/store information from the subject computer.

Hope this helps,
Brett.

Just because something can be done doesn’t mean it's a good idea...but how will you know 'till you try.
 
this should work.

Private Sub Command0_Click()
On Error GoTo error1
Dim p1 As String
p1 = Environ("SystemRoot") & "\explorer.exe" & " \\" & [Server ID] & "\c$"

Call Shell(p1, vbNormalFocus)

GoTo end1

error1:
MsgBox Err.Description

end1:

End Sub
 
Thanks very much guys, I will check out both pieces of code when I get into work tomorrow.

Very much appreciated

ModeX
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top