Jump to content

This site uses cookies. By continuing to browse the site you are agreeing to our use of cookies. Find out more here. X
X


Photo

Users Profile Folders


  • Please log in to reply
62 replies to this topic

#21 startrek133

startrek133

    Wayfarer

  • Active Members
  • Pip
  • 50 posts

Posted 25 August 2011 - 03:02 PM

right now i am just trying to get this to run on my windows xp box , before i use it on the live server ..

the error i get is the following ..

line 398 (file"location"):
error: error parsing function call.







#22 hannes08

hannes08

    my oh my

  • Active Members
  • PipPipPipPipPipPip
  • 944 posts

Posted 25 August 2011 - 03:20 PM

So you went ahead and compiled it ...
Please run this from the Scite Editor:
#include <file.au3> Dim $a_users Dim $s_userfolder = "D:\users\" _FileReadToArray("users.txt", $a_users) For $i = 1 To $a_users[0]     ConsoleWrite("DirCreate(" & $s_userfolder & $a_users[$i] & ")" & @CRLF)     ConsoleWrite("ICACLS.exe " & $s_userfolder & $a_users[$i] & " /grant " & $a_users[$i] & ":(OI)(CI)(RX,W,DC)" & @CRLF) Next


Note, I probably forgot to close the DirCreate() Function call.
Regards,Hannes
Spoiler

#23 startrek133

startrek133

    Wayfarer

  • Active Members
  • Pip
  • 50 posts

Posted 25 August 2011 - 03:28 PM

yea i saw that is was missing the right bracket , so i closed and re complied it , and ran it and it crashed my system .. it just kept opening them and opening ..

this one doesnt work either Hannes sorry to say ..

errors out with "incorrect number of parameters in function call"

well if i take out the Msgbox , it runs so quick i cant see it , but nothing happens .. no folder made or anything ...

#include <file.au3> Dim $a_users Dim $s_userfolder = "c:\" _FileReadToArray("test.txt", $a_users)   For $i = 1 To $a_users[0]     ConsoleWrite("DirCreate(" & $s_userfolder & $a_users[$i] & ")" & @CRLF)     ConsoleWrite("ICACLS.exe " & $s_userfolder & $a_users[$i] & " /grant " & $a_users[$i] & ":(OI)(CI)(RX,W,DC)" & @CRLF) Next   MsgBox(0, "Done")

Edited by startrek133, 25 August 2011 - 03:29 PM.


#24 hannes08

hannes08

    my oh my

  • Active Members
  • PipPipPipPipPipPip
  • 944 posts

Posted 25 August 2011 - 06:07 PM

Hello Startrek,

please skip the compilation, because then you have very less possibilities to debug your script. Have you installed SciTe4AutoIT? Because then you can run the scripts by pressing "F5".
The output will be shown in the lower pane.
Secondly the wrong function call is caused by your MsgBox(). If you'd run it in Scite you would have seen this output:
C:\Users\hannes\Desktop\New AutoIt v3 Script.au3(9,17) : ERROR: MsgBox() [built-in] called with wrong number of args. MsgBox(0, "Done") ~~~~~~~~~~~~~~~~^
This shows you directly what is wrong. :mellow:
Regards,Hannes
Spoiler

#25 startrek133

startrek133

    Wayfarer

  • Active Members
  • Pip
  • 50 posts

Posted 25 August 2011 - 06:38 PM

yes i have autoit installed .. and when i hit f5 , it does run , but when i go check my c:\ i see no users folder there ..

I maybe new to program and all this, but i am not a total idiot ..

#26 hannes08

hannes08

    my oh my

  • Active Members
  • PipPipPipPipPipPip
  • 944 posts

Posted 25 August 2011 - 06:56 PM

Okay let's go slow:

1. create a new Folder under your C:\ drive called "test"
2. Edit the ACL of that folder by the following:
Under Advanced settings:
Break the inheritance and copy the settings from the parent foler (in this case C:\)
Remove all ACL settings Except the FullControls of Administrators and SYSTEM
Under "Normal Settings":
Add the "Users" group and greant them "ListFolder" rights only
Under Advanced settings:
Change the inheritance of the Users Group to "This folder only"
3. Compile and run this script:
#RequireAdmin #AutoIt3Wrapper_Change2CUI=y #include <file.au3> Dim $a_users Dim $s_userfolder = "c:\test\" _FileReadToArray("test.txt", $a_users) For $i = 1 To $a_users[0]     ConsoleWrite(DirCreate( $s_userfolder & $a_users[$i]) & @CRLF)     RunWait("ICACLS.exe " & $s_userfolder & $a_users[$i] & " /grant test:(OI)(CI)(RX,W,DC)") Next MsgBox(0,"Done","Check Console output!")


Tell me what's your output!
.. And nobody said you'd be an idiot at all.
Regards,Hannes
Spoiler

#27 rcmaehl

rcmaehl

    No where near a noob nor a pro coder.

  • Active Members
  • PipPipPipPipPipPip
  • 675 posts

Posted 25 August 2011 - 07:05 PM

well i tired every different way I know of to get that array to work and still the same issue , it will make the folder , but will not set any of the security settings or permissions ..

and for some reason even putting END after the WEnd the script still runs and i have to right click on it to exit it out ..

never though it would be this hard .. here are the different ways i tried the array with no luck ..

You're supposed to put END at the end of the text file not the script

My UDFs are generally for me. If they aren't updated for a while, it means I'm not using them myself. As soon as I start using them again, they'll get updated.

 

Current Projects:

IRC UDF, for IRC activities

SafeExecute, for picking and choosing what commands you want Execute to be able to run.


#28 startrek133

startrek133

    Wayfarer

  • Active Members
  • Pip
  • 50 posts

Posted 25 August 2011 - 07:16 PM

You're supposed to put END at the end of the text file not the script


Sorry Rcmaehl

been getting confused with everyone saying try Icacls, or just the cacls .. but still cant get yours to work .. when i sub out "c:\username" for the array , it will make the folder , i get the pop up that says everything is done .. but when i get the folder nothing was set :mellow:

#29 startrek133

startrek133

    Wayfarer

  • Active Members
  • Pip
  • 50 posts

Posted 25 August 2011 - 07:32 PM

Sorry Hannes, didn't work again .. in fact is crashed my system again .. hit f5 to run the script and open hundreds of them again and crashed ..

plus not sure why i have to make the folder and set the permission , that is the whole point of this is to make the users folder and set the permissions .. the trouble seems to be when i try to use the txt file with the list of usernames ..

but thanks for the help ..

#30 hannes08

hannes08

    my oh my

  • Active Members
  • PipPipPipPipPipPip
  • 944 posts

Posted 25 August 2011 - 07:57 PM

Maybe it would be a good start by using 5 to 10 test entries in your input file instead of 200.
Well setting this rights is to ensure that the users do not get the right to see each other's files.
If you are in a domain enviroment and want to set rights to the domain users you need to write the user name like mydomain\username .
Regards,Hannes
Spoiler

#31 startrek133

startrek133

    Wayfarer

  • Active Members
  • Pip
  • 50 posts

Posted 25 August 2011 - 08:17 PM

I only have 1 entry in the test file right now ... nothing else ..

yea i know that part, once i get everything working i will be switching a lot of the c:\ stuff to \\servername\profile and changing the "username" to \\domain\username ..

my goal was to first get it working on my computer before i started playing around with live servers and users ..

but if i have to manual go set every folder that this program makes then it's pointless to keep going .. the whole point so for this script to do it for me .. its easy to have the script make all the folders ..

thanks

#32 rcmaehl

rcmaehl

    No where near a noob nor a pro coder.

  • Active Members
  • PipPipPipPipPipPip
  • 675 posts

Posted 26 August 2011 - 11:47 AM

I'm trying to figure it out myself. I've been screwing around with my script for a while. Can you run this and paste the console output:

AutoIt         
#include <File.au3> ;Making of the folders from a txt file; Global $User, $Line $Line = 1 While 1     $User = FileReadLine("test.txt", $Line)     If Not ($User == "END") Then         DirCreate("c:\"&"\"&$User)         $Line += 1     Else         MsgBox(0x0, "Done", "END Encountered, Script is Done.")         Exit(0)     EndIf     ; Removing the Inheritance Flag ;     RunWait(@ComSpec & ' /c c:\XCACLS.vbs "' & $USER & '" /I Copy', @ScriptDir, @SW_HIDE)     ConsoleWrite(@ComSpec & ' /c c:\XCACLS.vbs "' & $USER & '" /I Copy', @ScriptDir, @SW_HIDE)     ; deleting "users" from the folder;     RunWait(@ComSpec & ' /c c:\XCACLS.vbs "' & $USER & '" /E /T /R "local\Users"', @ScriptDir, @SW_HIDE)     ConsoleWrite(@ComSpec & ' /c c:\XCACLS.vbs "' & $USER & '" /E /T /R "local\Users"', @ScriptDir, @SW_HIDE)     ; give admins owernship ;     RunWait(@ComSpec & ' /c c:\subinacl /subdirectories "' & $USER & '" /setowner="Administrator"', @ScriptDir, @SW_HIDE)     ConsoleWrite(@ComSpec & ' /c c:\subinacl /subdirectories "' & $USER & '" /setowner="Administrator"', @ScriptDir, @SW_HIDE)      ; give myself full controll ;     RunWait(@ComSpec & ' /c c:\XCACLS.vbs "' & $USER & '" /E /T /G domain\username:F', @ScriptDir, @SW_HIDE)     ConsoleWrite(@ComSpec & ' /c c:\XCACLS.vbs "' & $USER & '" /E /T /G domain\username:F', @ScriptDir, @SW_HIDE)      ; give user full controll ;     RunWait(@ComSpec & ' /c c:\XCACLS.vbs "' & $USER & '" /E /T /G domain\username:F', @ScriptDir, @SW_HIDE)     ConsoleWrite(@ComSpec & ' /c c:\XCACLS.vbs "' & $USER & '" /E /T /G domain\username:F', @ScriptDir, @SW_HIDE)     WEnd

Edited by rcmaehl, 26 August 2011 - 11:48 AM.

My UDFs are generally for me. If they aren't updated for a while, it means I'm not using them myself. As soon as I start using them again, they'll get updated.

 

Current Projects:

IRC UDF, for IRC activities

SafeExecute, for picking and choosing what commands you want Execute to be able to run.


#33 startrek133

startrek133

    Wayfarer

  • Active Members
  • Pip
  • 50 posts

Posted 26 August 2011 - 12:14 PM

still no luck Rcmaehl

i pasted it in and hit F5 to run it and errors out at the ConsoleWrite command part ..


>"C:\Program Files\AutoIt3\SciTE\AutoIt3Wrapper\AutoIt3Wrapper.exe" /run /prod /ErrorStdOut /in "\\my docs\Folder Maker\test.au3" /autoit3dir "C:\Program Files\AutoIt3" /UserParams +>08:11:57 Starting AutoIt3Wrapper v.2.0.3.0 Environment(Language:0409  Keyboard:00000409  OS:WIN_XP/Service Pack 3  CPU:X64 OS:X86) >Running AU3Check (1.54.19.0)  from:C:\Program Files\AutoIt3 \\my docs\Folder Maker\test.au3(22,94) : ERROR: ConsoleWrite() [built-in] called with wrong number of args.     ConsoleWrite(@ComSpec & ' /c c:\XCACLS.vbs "' & $USER & '" /I Copy', @ScriptDir, @SW_HIDE) ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^ \\my docs\Folder Maker\test.au3 - 1 error(s), 0 warning(s) !>08:11:57 AU3Check ended.rc:2 >Exit code: 0    Time: 0.753

Edited by startrek133, 26 August 2011 - 12:16 PM.


#34 rcmaehl

rcmaehl

    No where near a noob nor a pro coder.

  • Active Members
  • PipPipPipPipPipPip
  • 675 posts

Posted 26 August 2011 - 12:21 PM

I totally failed there. I forgot to copy the entire runwait commands into the consolewrites.

My UDFs are generally for me. If they aren't updated for a while, it means I'm not using them myself. As soon as I start using them again, they'll get updated.

 

Current Projects:

IRC UDF, for IRC activities

SafeExecute, for picking and choosing what commands you want Execute to be able to run.


#35 startrek133

startrek133

    Wayfarer

  • Active Members
  • Pip
  • 50 posts

Posted 26 August 2011 - 12:28 PM

huh at least you know what your talking about , i was tiring to look up with the consolewrite command did and find examples and its slow going .. i hate how they don't teach you any of this at school!!!!!!

#36 rcmaehl

rcmaehl

    No where near a noob nor a pro coder.

  • Active Members
  • PipPipPipPipPipPip
  • 675 posts

Posted 26 August 2011 - 12:30 PM

huh at least you know what your talking about , i was tiring to look up with the consolewrite command did and find examples and its slow going .. i hate how they don't teach you any of this at school!!!!!!


O_o You learned autoit at school!?

My UDFs are generally for me. If they aren't updated for a while, it means I'm not using them myself. As soon as I start using them again, they'll get updated.

 

Current Projects:

IRC UDF, for IRC activities

SafeExecute, for picking and choosing what commands you want Execute to be able to run.


#37 hannes08

hannes08

    my oh my

  • Active Members
  • PipPipPipPipPipPip
  • 944 posts

Posted 26 August 2011 - 12:35 PM

PLEASE! Change $s_basefolder and $s_inputfile, compile the script and run it. I tested it and it runs good.

#AutoIt3Wrapper_Change2CUI=y #include <file.au3> Dim $s_basefolder = "C:\Test" Dim $s_inputfile = "C:\jobs\users.txt" Dim $a_users DirCreate($s_basefolder) RunWait("icacls.exe " & $s_basefolder &  " /inheritance:d") RunWait("icacls.exe " & $s_basefolder &  ' /remove:g "CREATOR OWNER"') RunWait("icacls.exe " & $s_basefolder &  ' /remove:g "BUILTIN\Users"') _FileReadToArray($s_inputfile, $a_users) For $i = 1 To $a_users[0]     DirCreate($s_basefolder & "\" & $a_users[$i] )     RunWait("icacls.exe " & $s_basefolder & "\" & $a_users[$i] & " /grant " & $a_users[$i] & ":(OI)(CI)(RX,W,DC)") Next


It isn't that hard to understand, is it?

Edited by Hannes123, 26 August 2011 - 12:35 PM.

Regards,Hannes
Spoiler

#38 startrek133

startrek133

    Wayfarer

  • Active Members
  • Pip
  • 50 posts

Posted 26 August 2011 - 12:35 PM

No I wish , we had it would have come in handy seeing how in the world of IT , you can make your life easier by script things out .. that is if you understand program code and stuff like that .. i tried for a week to write this up before posting on .. I just hope it can be done , because i really don't want to have to hand type out 200+ folders and then set all the permissions ..

#39 rcmaehl

rcmaehl

    No where near a noob nor a pro coder.

  • Active Members
  • PipPipPipPipPipPip
  • 675 posts

Posted 26 August 2011 - 12:37 PM

PLEASE! Change $s_basefolder and $s_inputfile, compile the script and run it. I tested it and it runs good.

#AutoIt3Wrapper_Change2CUI=y #include <file.au3> Dim $s_basefolder = "C:\Test" Dim $s_inputfile = "C:\jobs\users.txt" Dim $a_users DirCreate($s_basefolder) RunWait("icacls.exe " & $s_basefolder &  " /inheritance:d") RunWait("icacls.exe " & $s_basefolder &  ' /remove:g "CREATOR OWNER"') RunWait("icacls.exe " & $s_basefolder &  ' /remove:g "BUILTIN\Users"') _FileReadToArray($s_inputfile, $a_users) For $i = 1 To $a_users[0]     DirCreate($s_basefolder & "\" & $a_users[$i] )     RunWait("icacls.exe " & $s_basefolder & "\" & $a_users[$i] & " /grant " & $a_users[$i] & ":(OI)(CI)(RX,W,DC)") Next


It isn't that hard to understand, is it?

O_o *Facepalms at his own stupidity.* Why didn't I think of that.

Edited by rcmaehl, 26 August 2011 - 12:37 PM.

My UDFs are generally for me. If they aren't updated for a while, it means I'm not using them myself. As soon as I start using them again, they'll get updated.

 

Current Projects:

IRC UDF, for IRC activities

SafeExecute, for picking and choosing what commands you want Execute to be able to run.


#40 hannes08

hannes08

    my oh my

  • Active Members
  • PipPipPipPipPipPip
  • 944 posts

Posted 26 August 2011 - 12:38 PM

O_o You learned autoit at school!?


I use AutoIT for my IT trainees, and I can tell it's fun for 90% of them :mellow:
Regards,Hannes
Spoiler




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users