Get Folder Rights On A Network Drive?
Sep 2, 2010
I want to know what rights the user has for a given folder on a network drive. But I can't find anything that does just this.
I have used DirectoryInfo.GetAccessControl and DirectorySecurity.GetAccessRules, etc. to get a collection (AuthorizationRuleCollection) of rules. But that gives me all the access groups and their rights. I don't need that (I guess I can see if I can find code that gets which returns the security groups for the current user and then compare those to the collection, but this seems awkward.)
Or I can write code that tries to create a file, delete it, etc. which is easy to do, but not quite accurate (if the user can't create a file, how can I see if the user can delete one, if the user has create, but not delete rights, I get a bunch of temp files, etc.)
All I need to know is if the current user has read write, read only, create, and/or delete rights to a given folder (and I guess file might also be nice - I would assume similar code.)
I have to believe that its a really simple thing. But Googling it and searching on the forums here didn't turn up much (unless I want code to change the users rights - which I don't.)
View 1 Replies
ADVERTISEMENT
Sep 26, 2011
To create a dynamic folder in local drive it was generating, if suppose we need to create a folder in network path means error say that cannot access to the path is denied, how to resolve this issue , i m working on vb.net
View 1 Replies
Feb 20, 2012
I am trying to read some data from the MBR using CreateFile, but I cannot get it to work without admin rights. The code I am using is like this:
hDevice = CreateFile("\.PhysicalDrive0", GENERIC_READ, FILE_SHARE_READ Or FILE_SHARE_WRITE, 0, OPEN_EXISTING, 0, 0)
Is it possible to read data from the MBR without admin rights?
View 1 Replies
Dec 3, 2009
Consider a network environment with a domain and active directory setup. I would like to create a shared folder on a server for a username added by whom ever the network administrator is... I would like to install my program on a computer, but when people log into te local machine, I don't want them to have access to the shared folder, I want the program to be able to access it only, using the afore mentioned user name and password.
View 4 Replies
Dec 10, 2008
Does anyone know if there is a way to determine if a drive is local or a network drive?
View 1 Replies
May 20, 2012
I understand all about giving Administrative Rights via the manifest. However...I'm sure I will have customers that may not want users to have Admin privileges. Is there a way I can grant rights to just the folder where I am writing data to(database and pdf files). The folder will be in Program Files/my company/....
View 5 Replies
May 11, 2010
I have a program that creates a root folder and sub-folder in the users C-drive.I unfortunatley did not think this through propaly. Senario = if a user does not have access to the C-drive and just has an account to thier 'My Documents' then they cannot use this program.How i achieve the C-drive root-folder, sub-folder, and eventually text file creation is as follows;
If
My.Computer.FileSystem.DirectoryExists("C:AMSFTAMSFT_RunnersDetails"
+ Label81.Text) Then[code]...
I do not what to change the format of this code too much as it is embedded heavily in my code, what i want to do is instead of checking and creating these folders and text files in the C-drive, i would like to change the location to a potentially unrestricted area, eg; 'my Documents'. how to alter this code to achieve this?
View 12 Replies
Aug 24, 2009
Compile DLL to network drive
View 1 Replies
Aug 30, 2010
I Have a batch file in a server in my network. I maped that shared folder (that batch file exist in it) every time that I want to run that batch file first I should have to connect to that network drive(with username and password) How can I do it in my code . I want to connect to that network drive by code in my form_load. I test codes below but it dose'nt work.
AppDomain.CurrentDomain.SetPrincipalPolicy(Princip alPolicy.WindowsPrincipal)
Dim idnt As New WindowsIdentity(username, password)
Dim context As WindowsImpersonationContext = idnt.Impersonate
View 3 Replies
Jul 10, 2009
I am using some like following code to get UNC path of drive letter.
Dim query As New System.Management.ObjectQuery("select * from Win32_LogicalDisk")
Using searcher As New System.Management.ManagementObjectSearcher(Query)
'loops for all drives on system
For Each Mgmt As System.Management.ManagementObject In searcher.Get()
And it was working but now it is giving error. Below is error with stack trace
{"Specified cast is not valid."}
at System.Management.ThreadDispatch.Start()
at System.Management.ManagementScope.Initialize()
at System.Management.ManagementObjectSearcher.Initialize()
at System.Management.ManagementObjectSearcher.Get()
I also want to know alternative way to get unc path of drive that is also not depend on windows API. As there is a class driveinfo to get all drives (including network) on system. Is there any class that also provide complete or unc path information of Drive.
View 6 Replies
Aug 16, 2011
I've followed the instructions found at the letter (albeit also adding the parameters to pass a username and password), but have had no success connecting to a network drive that requires authentication to access.
View 8 Replies
Sep 2, 2011
I'm working on a program that is used as a tool to quickly search & Open CAD drawings on our network. I have it working for the most part, but it is very slow. Right now I have an ini file with the path to the Directory I want to search for Example "G:" I think the reason this is so slow, is because there are other folders in this directory that don't need to be searched. My idea is to add all of the paths I want the program to search in the ini file, but I don't know how I will have it search through this using vb code
want my ini file to look like this
G:A
G:B
G:C
G:E
So directory D would not be searched by the program because its not in the list.
MyCode
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
Dim PathReader As IO.StreamReader
PathReader = IO.File.OpenText("C:ISOExplorerPath.ini")
[code]....
View 10 Replies
Mar 27, 2009
i have a network drive mapped to z each time i turn on the pc that drive is disconnected but i can see the z letter and if i click they return, there is some way to active that letter/drive but vb.net?
View 1 Replies
Mar 2, 2010
How can I map a network drive over a Windows Service. What I did until now.
Using the Shell command. -> not working.
vb.net
Shell("net use \" & My.Settings.ParaRootPath & " " & My.Settings.ParaPasswordHTTPS & " " & "/user:" & My.Settings.ParaLoginHTTPS)
Using a System.Diagnostics.Process object. -> not working
vb.net
ShellExecute As New System.Diagnostics.Process
ShellExecute.StartInfo.RedirectStandardOutput = True
ShellExecute.StartInfo.FileName = "cmd.exe"
[Code].....
If I run the application as normal application, it is working correctly.
View 2 Replies
Mar 29, 2008
How can I save a file to a folder on a network drive. I have the drive mapped on my pc as "G:" but someone else could have it mapped as "Q:" or something. I can save if I use "G:ServerNameDriveNamefolder"; but can't from another pc unless I change the code to what the drive is mapped to on that pc.
Here is the code I'm trying to use to direct to the folder with out using the mapped drive:
Code:
Private Sub Button9_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button9.Click
FileOpen(1, "\ServerNameDriveNameFolder" & filenamec.Text, OpenMode.Output) 'location of the file.
View 1 Replies
Jun 30, 2009
I have developed a visual basic app in Visual studio 2008. I have created a windows installer file. Can I deploy this on a network drive and does .NET framework have to be installed on server? The application has a MS access database associated with it, so I would like to have it backed up via the network.
View 1 Replies
Apr 4, 2009
I am working on a win application that maps/unmaps network drives. And i have a couple of problems getting and setting a mapped network drive's label /name. The driveinfo volumelabel property will get or set the label of the remote drive/folder, what i need is the mapped network drive name/label on the local system. it then adds the driveletter, volumelabel, and connection state to a listview.
[Code]....
View 1 Replies
Mar 28, 2010
my first question on this board. I'm creating a media player(Like so many others). I try playing files over my network. When I pass this address "M:songssome artistsome song.mp3" to the windows media player control it actually opens "\ServerMEDIAsome artistsome song.mp3". But when my program checks if it is playing the correct song it thinks it is not, because the strings aren't equal. Is there a way in VB to get the network address of a mapped network drive? I can already see that it is a network drive but not wich address it points to.
View 2 Replies
Mar 8, 2010
i have a NAS drive that is mapped to my system..My application will copy files to the drive but the only problem is the drive has a sleep function on it therefore when i try to copy files to it and it is in sleep mode, it says the folder does not exist (drive still in my computer but just with a red X on it)is there a function to make ir ready ? the only other way to do it is to double click the drive icon in my computer then it wakes up... but id rather not do this as its a pain.
View 3 Replies
Feb 19, 2009
I'm developing an application that needs to Map a network drive for a domain user logged into a domain PC from a remote location. I have tried numerous different things with different levels of success but none with the required functionality. - First, I used WMI to create a process that would run Net Use with no luck: Net Use would ask for a user name and password to connect to the share instead of using the User's credentials.- Second I generated a script (wshNetwork) that would be copied to the remote PC and used WMI to once again create a process that would run wscript in command prompt to execute the copied script.
The script would run successfully (as evident by code placed to fill in a text file when the script completed) but the network drive was not added.- Third I created a program that would be copied to the user's PC which would map the drive using Windows Network API. Again, I used WMI to execute the program as a proccess with the results the same as the script. The application would run successfully but the drive was not added.- Fourth, I edited the user's registry to add the drive. This worked, however the mapped drive was not usable through Windows Explorer without a reboot.
Unfortunately, one of the requirements of the application is to avoid rebooting the remote PC.I have arguably had the greatest success with the following:- I used WMI to generate a scheduled task on the remote PC that would run a script (wshNetwork), an application (Win API) or the Net Use command to map the drive. All resulted in the drive being properly mapped and visable through windows explorer with the files accessable. However, the new map would be labeled "Disconnected Network Drive" and the drive could not be removed (error: network connection could not be found) and the driver letter could not be used without rebooting the system. Anyone have any suggestions on how I can do this? Unfortunately I can't use wshController to run a remote script because a majority of the PCs on the domain are not configured to use it.
View 10 Replies
Nov 20, 2009
I want my high school students to be able to save their VB projects to their network drive folder on the school's fileserver. The students do not have access to the c: drive by Group Policy. VB does not even see the network drive each student has mapped. I have googled around and discovered it has to do with VB not trusting any network folders. There is a supposed solution by using the .net framework configuration tool but I had no success getting that to work. Right now I have them saving their project to their usb drives. They have a tendency to lose or forget those. Is there a simple way of getting those network folders accessable?
View 2 Replies
Nov 23, 2009
I teach using VB. At the moment the kids are having to save their projects to usb drives because VB does not see the network folders on the fileserver. They lose the usb drives. The kids do not have access to the c: drive by Group Policy. How can I set up VB.net to see the their network drive folder?
View 2 Replies
Sep 16, 2009
I have compiled my application using vs2005 and put the exe and dlls on a network drive. The users running windows 7 that don't have write access to the folder cannot run the program. The users on XP can run the program even without write access to the folder. The admins with write access to the folder can run it on both XP and windows 7. Does anyone know what I need to do to fix it other than giving the user write access to the folder.
View 1 Replies
Sep 16, 2009
We are getting a new server and we already have a Z: drive mapped, and we want to use the same letter and just change the path without touching all machines. I am looking for a simple VBscript to do that. I have one that will remove and one that will add, but I need to have on script.
View 1 Replies
Oct 18, 2009
I use the following code to layout network drives on a system. I want to add a third column for persistence but in vb.net I do not know how to check if a drive has a persistent map or not.
For Each drive_info As DriveInfo In DriveInfo.GetDrives()
If drive_info.DriveType().ToString = "Network" Then
With maps.Items.Add(drive_info.Name)
[code]......
View 2 Replies
Jul 7, 2010
I need to map a network drive from within a .NET application. I'm going to need to use an AD Username and Password to authenticate. Usually I just use a batch file with the net use command. How do I do this from within C# or VB.NET code?
View 4 Replies
Jan 18, 2009
I'd like to write a VB script that maps a network drive, but I don't really know where to start. I'd like to script to ask for a username and password, then map the drive.should I write it VB or as a CMD batch file? NET USE Z: \serverfolder\%user% /USER:%USER%@domain /password:%pass%am not even sure I've got that syntax write.
View 5 Replies
Oct 14, 2010
Currently I am trying to create a small application which will be used to map a common network drive on an offline computer. Currently my form has: Location Username Password Domain I have these all setup so that when I click to map the drive it will automatically grab the entered information and map it to the W drive. I tried the code below but it isn't working, stating a W32 exception.
[Code]...
View 3 Replies
Aug 3, 2011
I'm having a issue connecting to a SQL server from a network drive. [URL]But i'm not sure how to give my assembly a strong name?
View 6 Replies
Dec 23, 2009
I was expecting this to be easy but it seems that it is not... all I want to do is loop through all drives on a computer and if the drive is a network drive then get the UNC path that this network drive maps to. Simples. I was expecting to just do this:
vb.net
For Each drv In IO.DriveInfo.GetDrives()
If drv.DriveType = IO.DriveType.Network Then
MessageBox.Show(drv.RootDirectory.ToString)
End If
Next
[Code]...
View 10 Replies