Photo Gallery Member List Search Calendars FAQ Ticket List Log Out


cacls to text file

 
Logged in as: Guest
arrSession:exec spGetSession 2,2,36609
 Active Users: There are 0 members and 0 guests.
 Users viewing this topic: none
 

 

 
  
  Printable Version
All Forums >> [Scripting] >> WSH & Client Side VBScript >> cacls to text file
  Do you like VisualBasicScript.com? Link to us and help spread the word about our forum. Thanks!
Page: [1]
Login
Message << Older Topic   Newer Topic >>
 cacls to text file - 7/30/2006 11:58:33 PM   
  ccoll52

 

Posts: 4
Score: 0
Joined: 10/30/2005
Status: offline
I can figure out how to send the access control list of a folder with cacls from the command prompt, but can't seem to figure how to do it with .vbs.
Any ideas?

Thanks
 
 
Post #: 1
 
 RE: cacls to text file - 7/31/2006 12:43:06 AM   
  Country73


Posts: 735
Score: 10
Status: offline
If you already know how to send it through the command prompt, then it's not too much of a change to send it through vbscript.

Set oShell = CreateObject("Wscript.Shell")
oShell.Run "cmd /c cacls \\<ComputerName>\<Share>\<Folder> /G Administrators:
F;F /E /Y",0,True

This is setting up that specific folder, Administrator Full Control, Editing so that the other permissions are not discarded.
No window is displayed
and wait for completion before stepping throught the rest of your code.




Completely messed this one up, please disregard, was using portion of an XCACLS script.


< Message edited by Country73 -- 7/31/2006 1:21:07 AM >

(in reply to ccoll52)
 
 
Post #: 2
 
 RE: cacls to text file - 7/31/2006 1:18:07 AM   
  Country73


Posts: 735
Score: 10
Status: offline
Sorry, jumped the gun a little bit on this. I re-read your post and realized you are wanting to import the information you would normally see in the command window into a text file.
For that, all you would need to do is:

Set oFS = CreateObject("Scripting.FileSystemObject")
Set oShell = CreateObject("Wscript.Shell")
Set x = oFS.OpenTextFile("Calc_Info.txt",8,True)
Set oExec = oShell.Exec("cmd /c cacls \\<computername>\<share>\<folder>")
   Do Until oExec.StdOut.AtEndOfStream
       myLine = oExec.StdOut.ReadLine
       x.WriteLine myLine
   Loop
   x.Close
   MsgBox "Finished running Calcs",0,"Calc_Info"

(in reply to Country73)
 
 
Post #: 3
 
 RE: cacls to text file - 7/31/2006 2:03:01 AM   
  ccoll52

 

Posts: 4
Score: 0
Joined: 10/30/2005
Status: offline
Thanks Country73,
 
that works great!!....thanks for your help

(in reply to Country73)
 
 
Post #: 4
 
 
 
  

If you found our site useful please link to us <a href="http://www.visualbasicscript.com">VisualBasicScript.com</a>.
All Forums >> [Scripting] >> WSH & Client Side VBScript >> cacls to text file Page: [1]
Jump to:





New Messages No New Messages
Hot Topic w/ New Messages Hot Topic w/o New Messages
Locked w/ New Messages Locked w/o New Messages
 Post New Thread
 Reply to Message
 Post New Poll
 Submit Vote
 Delete My Own Post
 Delete My Own Thread
 Rate Posts