|
-
Aug 18th, 2012, 02:23 AM
#1
Thread Starter
Lively Member
[RESOLVED] Help making a file browser to view files on remote PC
I have a simple app that allows me to browse files locally on my PC. I need some help figuring out how to code it to where I can also browse files on a specified remote PC by going to \\Computername\C$
I know that I can browse the contents of a remote PC's drive by typing in \\Computername\C$ in start>run and do it through explorer, but I need to be able to do it through my app instead.
Also, would like to see if there is a way to launch a .exe or .msi remotely through this file browser as well, on the targeted/remote machine.
I have been using PSTools>PSExec.exe to launch the .exe/.msi's on the target machine, but wouldn't mind being able to do it all through VB instead if possible.
Thanks everyone!
here is the code to the file browser I'm using:
Code:
Private Sub Dir1_Change()
File1.Path = Dir1.Path
txtFileandPath.Text = ""
End Sub
'
Private Sub Drive1_Change()
On Error Resume Next
File1.Path = Drive1.Drive
Dir1.Path = Drive1
Errmsg:
If Drive1.Drive = LCase("A:") Then
MsgBox LCase("" & Drive1.Drive & " drive error. " & Error$(Err)), 64
Else
End If
End Sub
'
Private Sub File1_Click()
txtFileandPath.Text = ""
txtFileandPath.Text = Dir1.Path & "\" & File1.FileName
Me.Caption = " " & Dir1.Path & "\" & File1.FileName
End Sub
-
Aug 18th, 2012, 03:48 AM
#2
Re: Help making a file browser to view files on remote PC
Create a new Form with a Command button
Add a Microsoft Common Dialog Control via Project menu - Components
Add this code;
Private Sub Command1_Click()
With CommonDialog1
.ShowOpen
End With
End Sub
Run it and click the button. That's the basics now read this http://msdn.microsoft.com/en-us/libr...(v=vs.60).aspx
-
Aug 18th, 2012, 06:20 AM
#3
Re: Help making a file browser to view files on remote PC
People should know they can defeat both of these exploits via registry settings that lock down admin shares.
Before doing this you should back up your registry, or at least export the original values of these keys to a .reg file.
You can use this file:
lockdown.reg
Code:
Windows Registry Editor Version 5.00
[HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\LanmanServer\Parameters]
"AutoShareServer"=dword:00000000
"AutoShareWks"=dword:00000000
-
Aug 18th, 2012, 12:13 PM
#4
Thread Starter
Lively Member
Re: Help making a file browser to view files on remote PC
 Originally Posted by Magic Ink
Create a new Form with a Command button
Add a Microsoft Common Dialog Control via Project menu - Components
Add this code;
Private Sub Command1_Click()
With CommonDialog1
.ShowOpen
End With
End Sub
Run it and click the button. That's the basics now read this http://msdn.microsoft.com/en-us/libr...(v=vs.60).aspx
I checked out the link, but I'm not sure this is what I need?
Do you have any example code or a form I could check out?
-
Aug 21st, 2012, 08:02 PM
#5
Thread Starter
Lively Member
Re: Help making a file browser to view files on remote PC
I found a solution. For testing purposes I added a texbox with the text of "\\Computer\C$" & a command button that points the Dir1.Path to whatever is in the textbox. I'll go in later and add some error checking.
I know that this is way simple but this works perfectly for me because I really just need to be able to see what files are on the PC. (I don't need to delete, rename, move/copy...although dragging a file onto my app and having it copy itsself to the specified path on the remote PC would be nice...
Once I find whatever .exe, msi, bat, cmd I'm looking for, then I can manipulate the path and use it with PSExec to launch them remotely.
Most of my end users don't have admin rights and they rely on getting software deployments through Micro$oft CM. There are some cases when they need 1 Off software installed, driver packages, etc...which I then have to remote into their machine and type in my credentials.
By using PSExec, I can launch it remotely as myself, with out having to type my info in. Sounds lazy I know, but it works great! This also automates the process to where all i have to do is find the file and click a button...and then I have PSexec launch with the proper switches, and it pulls the file path I want to launch from the file browser.
I can add some of the code later if anyone wants to see it.
Code:
Private Sub Command1_Click()
Dir1.Path = "\\Computer\C$"
End Sub
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|