473,385 Members | 2,044 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,385 software developers and data experts.

Helllp with CACLS in VB.NET!

in VB.NET, I am trying to assign Group rights to a network file. I am
successfull at impersonating a domain account with rights but the following
code is failing, ie, nothing happens at the file level.

MyProcessString = "cacls.exe """ + ICopyTo + """ /E /G """ + ICopyRights +
""":R"
System.Diagnostics.Process.Start(MyProcessString)
msgbox(MyProcessString)
the MyProcessString MsgBox shows: cacls.exe
"\\main\documents\filename.txt" /E /G "DOMAIN\group name":R
cacls does work with group names and I can get this code to run as a batch
file under the impersonation runas account just fine

I have also tried:
p.StartInfo.FileName = "cacls.exe"
p.StartInfo.Arguments = MyProcess '"" + ICopyTo + """ /E /G """ +
ICopyRights + """:R"
p.StartInfo.Arguments = ICopyTo + " /E /G " + ICopyRights + ":R"
p.StartInfo.RedirectStandardOutput = True
p.StartInfo.UseShellExecute = False
p.StartInfo.WindowStyle = ProcessWindowStyle.Minimized
p.StartInfo.CreateNoWindow = True
p.Start()
p.WaitForExit()
ProcessOutput = p.ExitCode.ToString()

but I get a variety of error numbers like error 5, etc.. and I do not know
where I can find error code interpretations and this does not work either
....

Any suggestions !

Thanks

Terry


Nov 21 '05 #1
1 2888
New information: I modified my code to see what is happening:
myProcess.StartInfo.WindowStyle = ProcessWindowStyle.Maximized
myProcess.StartInfo.RedirectStandardOutput = False
myProcess.StartInfo.CreateNoWindow = False

and type my CACLS code manually and I get an Access is denied - error number
5
so I guess the problem is that when I shell out within my impersonation
area - that the rights are not transfered ... hmmm

"Support" <Re****************@mail.oci.state.ga.us> wrote in message
news:um**************@TK2MSFTNGP15.phx.gbl...
in VB.NET, I am trying to assign Group rights to a network file. I am
successfull at impersonating a domain account with rights but the
following code is failing, ie, nothing happens at the file level.

MyProcessString = "cacls.exe """ + ICopyTo + """ /E /G """ + ICopyRights +
""":R"
System.Diagnostics.Process.Start(MyProcessString)
msgbox(MyProcessString)
the MyProcessString MsgBox shows: cacls.exe
"\\main\documents\filename.txt" /E /G "DOMAIN\group name":R
cacls does work with group names and I can get this code to run as a batch
file under the impersonation runas account just fine

I have also tried:
p.StartInfo.FileName = "cacls.exe"
p.StartInfo.Arguments = MyProcess '"" + ICopyTo + """ /E /G """ +
ICopyRights + """:R"
p.StartInfo.Arguments = ICopyTo + " /E /G " + ICopyRights + ":R"
p.StartInfo.RedirectStandardOutput = True
p.StartInfo.UseShellExecute = False
p.StartInfo.WindowStyle = ProcessWindowStyle.Minimized
p.StartInfo.CreateNoWindow = True
p.Start()
p.WaitForExit()
ProcessOutput = p.ExitCode.ToString()

but I get a variety of error numbers like error 5, etc.. and I do not know
where I can find error code interpretations and this does not work either
...

Any suggestions !

Thanks

Terry

Nov 21 '05 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
by: Jeff Knudson | last post by:
I am looking for the C# equivalent of invoking the CACLS command in VBScript to set the permissions on a new user account HomeDirectory. I think I'm close, but my permissions are listed under...
24
by: Randall Arnold | last post by:
I know how to use MSHTML to grab the innerhtml from an html web page, but what if I want to look at elements of a rendered aspx page? Is there any way to do this using the MSHTML DOM object? ...
17
by: Jon B | last post by:
Hi All! I have a ASP.NET 2.0 site that works on the Windows 2000 Server. However, when I tried to view this site on my local Windows XP machine, I get "Server Unavailable". If I switch the...
0
by: Elroyskimms | last post by:
I need to execute a batch file via ASP.Net. In my VB.Net code, I'm using System.Diagnostics.Process to call the batch file and its appropriate command line arguments. I'm using...
5
by: dananrg | last post by:
Is there a standard library module in Python 2.4 (Win32) that will return directory permissions / ACLs (e.g. users, groups, and what rights they have)? Otherwise, I'm faced with sending "cacls...
23
by: deathtospam | last post by:
A day or two ago, I wrote a quick ASPX page with a CS codebehind using Visual Studio .NET 2005 -- it worked, I saved it and closed the project. Today, I came back to the project, reopened the...
0
by: johnmburgess | last post by:
I am trying to give local machine users full access to a folder on their machine. I am logging in to the local machine as a member of the administrators group but I am still unable to...
0
by: =?Utf-8?B?TGlhbSBNYWM=?= | last post by:
Hi Folks, I have embeded WMI scripting within a Visual Basic application to create remote shares and set permissions, I'm now moving to vb.net environment and having trouble getting my scripting...
3
by: =?Utf-8?B?TGlhbSBNYWM=?= | last post by:
Folks, Not sure if this is the correct forum for this posting, but I'm banging by head against the wall, I have been trying to use my WSH scripts in vb. net environment but not having much joy....
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.