I succeed to share folder in WinXP and Win7 (Using this method)
But I have a problem, when I'm trying to share a folder using Win8.
It gives me an error and says that I have to run an .exe file as administrator.
Asked
Active
Viewed 47 times
1
-
1Yes you will need to be an administrator to do this. The same I suspect is true on Windows 7 if UAC is turned on. – Matt Wilko Dec 05 '13 at 13:09
-
I turn UAC off on Win 8 and I still can't share dir.. I think that I must run program as administrator programaticaly, but I don't know how to do it since my program is on .net 2.0.? – Naum Dec 05 '13 at 13:21
2 Answers
0
If your original program is not running Elevated and you want to start an application elevated (As Admin) you will have to do something like this (this will prompt for elevation):
Dim procStartInfo As New ProcessStartInfo
Dim procExecuting As New Process
With procStartInfo
.UseShellExecute = True
.FileName = "FileName.exe"
.WindowStyle = ProcessWindowStyle.Normal
.Verb = "runas" 'add this to prompt for elevation
End With
procExecuting = Process.Start(procStartInfo)

Hoh
- 1,196
- 1
- 12
- 30
0
You need to change you application manifest so that it will only run as an administrator.
Application Properties>Application Tab>View Windows Settings
Then change this line to requireAdministrator
<requestedExecutionLevel level="requireAdministrator" uiAccess="false" />
See this for more information: http://msdn.microsoft.com/en-us/library/vstudio/tzdks800(v=vs.120).aspx
Also see this SO question on the same topic: How do I force my .NET application to run as administrator?

Community
- 1
- 1

Matt Wilko
- 26,994
- 10
- 93
- 143
-
-
1I think this setting came in in Visual Studio 2008 it was then called `View UAC Setings` http://msdn.microsoft.com/en-us/library/vstudio/tzdks800(v=vs.90).aspx – Matt Wilko Dec 05 '13 at 13:53
-