Skookum
Butt Sniffer


Joined: 26 Oct 2001 Posts: 1541
Location: I dunno, I lost my Mommy
|
Posted:
Thu Sep 27, 2007 2:38 pm Post subject: VBS and Cacls |
|
Alright, I am so frusterated right now.
I have not been able to figure this out and I have been playing with it for far to long.
I have created a script that parses the ACLs for files and folders and dumps them into a database so we can keep track of folder permissions.
I spent a little while figuring out how to parse the information just right from the cacls dump.
So when the easy part comes up where I have to iterate through the folders and pass the folder name to the cacls command everything dies.
For some reason when ever I run a cacls command using VBS it runs the whole script twice, and at the same time.
Here is my test script code thingy
Set objSHell = WScript.CreateObject("WScript.Shell")
Start = Now
objShell.Run "cmd /c cacls l:\Installs > C:\Bat\cacls\cacls.txt",7,True
Wscript.Echo "Script Completed in " & DateDiff("s", Start, Now) & " Seconds"
As you can see the last line of my script tells me how long the script takes to run. The interesting part is that I get that prompt twice normally about 3 seconds apart.
Yes I only clicked on it once, yet it runs it twice. I've tried rebooting and still the same thing.
The script at this point is failing because the first time it runs some command line something that ties up the folder I am scanning, and then the second time it runs it says that the file is in use. And when the file runs the second time it overwrites my output file with a blank.
I have tried
objShell.Run "%comspec% /K"
objShell.Run "%comspec% /c"
set objExecObject = objShell.Exec "%comspec% /K"
set objExecObject = objShell.Exec "%comspec% /K"
And I have tried them both with cmd /c and still the same result. I then tried removing the command prompt from the equation and it runs once, but it does not appear to run the cacls or populate the file.
Stupid ACLs. |
_________________ "Paranoia is no longer a mental illness it is a way of life" - Me
|
|
Skookum
Butt Sniffer


Joined: 26 Oct 2001 Posts: 1541
Location: I dunno, I lost my Mommy
|
Posted:
Fri Sep 28, 2007 10:05 am Post subject: |
|
Alright, I am officially a retard.
I found the problem.
The vbscript that I was running was named Cacls.vbs
So when ever I ran the cmd /c cacls it would rerun the vbscript.
I have it working now except for the database part. I will post the completed script once I get the database thing working. |
_________________ "Paranoia is no longer a mental illness it is a way of life" - Me
|
|