Ben Sherrill Posted April 10, 2006 Share Posted April 10, 2006 The past couple of days I have been trying to script a GUI related innerface with the XCACLS.VBS for my company so that we could have a quick and easy way to run XCACLS instead of having to try and look up all the switches that are used in it. So I created this little program. You could modify it the way you want, however there are consistency checks in it to make sure that the switch inputs are done correctly. Below is the script and I have attached both the XCACLS and the AU3 script for it. I will answer any questions on it, and all comments are welcomed. If do use this script just remember that I have added in \\Server\Directory in a couple of places you will need to change these according to where your files are saved. Otherwise you might have trouble.This was my first time to write in GUI innerfacing. I feel like a scholar now. ; ----------------------------------------------------------------------------;; AutoIt Version: 3.1.0; Author: Ben Sherrill <ben.sherrill@albemarle.com;; Script Function:exit; Changing Group and user permissions using XCACLS;; ----------------------------------------------------------------------------#include "GUIConstants.au3"#include <file.au3>#include <Process.au3>opt("WinTitleMatchMode", 2);Message about the program that will be used;MsgBox features: Title=Yes, Text=Yes, Buttons=OK, Icon=WarningMsgBox(48, "Change File Permissions", "The following will change permissions for a Group of users or a Specific user using Xcacls.vbs. To learn more about Xcacls.vbs and its command line options, please see http://support.microsoft.com/?id=825751 'How to use Xcacls.vbs to modify NTFS permissions'");Checks to make sure that XCACLS.VBS exists in specified areaIf FileExists("xcacls.vbs") Then Else ;MsgBox features: Title=Yes, Text=Yes, Buttons=OK, Icon=Warning MsgBox(48, "File Not Found", "The file Xcacls.vbs was not found! Please make sure that this file is in the same directory as the File Permissions.exe file. Program will now close.") ExitEndIf;Creates a GUI innerface for determining whether or not you want to change permissions on a File or on a Directory.GUICreate("File Location", 275, 150)$label1 = GUICtrlCreateLabel("Choose either a File or a Directory.", 10, 10)$labelfile = GUICtrlCreateLabel("To Choose a file click this file", 10, 35)$labelfolder = GUICtrlCreateLabel("What file do you want to change?", 10, 75)$okbutton = GUICtrlCreateButton("OK", 10, 115, 45, 20)$cancel = GUICtrlCreateButton("Cancel", 70, 115, 45, 20)$browse = GUICtrlCreateButton("File", 200, 50, 45, 20)$browse2 = GUICtrlCreateButton("Directory", 200, 90, 48, 20);Create input Box$input = GUICtrlCreateInput("", 10, 50, 170, 20)$input1 = GUICtrlCreateInput("", 10, 90, 170, 20)GUICtrlSetState(-1, $GUI_ACCEPTFILES); Show GUI, and wait for OK to be pressedGUISetState()While 1 $msg = GUIGetMsg() Select Case $msg = $GUI_EVENT_CLOSE Exit Case $msg = $okbutton ExitLoop Case $msg = $cancel ExitLoop Case $msg = $browse $sFileLocation = FileOpenDialog("Select File or Folder", " ", "All (*.*)", 2) GUICtrlSetData($input, $sFileLocation) Case $msg = $browse2 $sFileLocation = FileSelectFolder("Select File or Folder", " ", "All (*.*)", 2) GUICtrlSetData($input1, $sFileLocation) EndSelectWEndGUIDelete();Lets the user know of the Directory/File they have Choosen to change the permissions to.MsgBox(4096, "Selection", "You have choosen " & $sFileLocation & " to change permissions on.");Ask for user/group to grant/revoke/deny rights to.;InputBox features: Title=Yes, Prompt=Yes, Default Text=NoIf Not IsDeclared("sgroupuser") Then Dim $sgroupuser$sgroupuser = InputBox("Group or User", "Please type in the Group or User account that you would like to give access to the file named " & @CRLF & @CRLF & $sFileLocation, "alb\cat_admins", " ", "300", "200", "-1", "-1")Select Case @error = 0 ;OK - The string returned is valid Case @error = 1 ;The Cancel button was pushed Exit Case @error = 3 ;The InputBox failed to open EndSelect;Displays and asks the user what type of options they would like to use. Grant Rights Deny Rights Revoke Rights Inherit Rights;InputBox features: Title=Yes, Prompt=Yes, Default Text=NoIf Not IsDeclared("sFileLocation") Then Dim $options1$options1 = InputBox("Program Options", "Please type which ever options you would like using spaces between each one." & @CRLF & @CRLF & "/e Edit ACL instead of replacing it." & @CRLF & @CRLF & "/g Grant security permissions." & @CRLF & @CRLF & "/r Revoke security permissions." & @CRLF & @CRLF & "/d Deny security permissions." & @CRLF & @CRLF & "/i (Enable/Copy/Remove) Inheritance flag. Enbale will turn on. Copy will turn off the flag and copy the inherited ACL's. Remove will turn off the flag and will not copy inherited ACL's.", "/e /g", " ", "450", "300", "-1", "-1")Select Case @error = 0 ;OK - The string returned is valid Case @error = 1 ;The Cancel button was pushed Exit Case @error = 3 ;The InputBox failed to open EndSelect;Runs and checks on the rights input in by the user to make sure that they have been done correctly.;If not Pops up an error message stating that if the script is run in its current condition that it may not create the correct rights.Select Case $options1 = "/e" ;MsgBox features: Title=Yes, Text=Yes, Buttons=OK and Cancel, Icon=Info If Not IsDeclared("iMsgBoxAnswer") Then Dim $iMsgBoxAnswer $iMsgBoxAnswer = MsgBox(65, "Your Editing Options", "Your options are" & @CRLF & $options1 & @CRLF & "using these options will not Grant or Revoke rights to " & $sFileLocation & " " & "for " & $sgroupuser & @CRLF & " Please exit the program and make sure to choose /g /r or /d to change rights.") Select Case $iMsgBoxAnswer = 1 ;OK Case $iMsgBoxAnswer = 2 ;Cancel Exit EndSelect Case $options1 = "/e /g" ;MsgBox features: Title=Yes, Text=Yes, Buttons=OK and Cancel, Icon=Info If Not IsDeclared("iMsgBoxAnswer") Then Dim $iMsgBoxAnswer $iMsgBoxAnswer = MsgBox(65, "Your Editing Options", "Your options are" & @CRLF & $options1 & @CRLF & "using these options will Edit and Grant rights to " & $sFileLocation & " " & "for " & $sgroupuser & @CRLF & " If this is not correct then press Exit and rerun the program!") Select Case $iMsgBoxAnswer = 1 ;OK Case $iMsgBoxAnswer = 2 ;Cancel Exit EndSelect Case $options1 = "/e /g /i enable" ;MsgBox features: Title=Yes, Text=Yes, Buttons=OK and Cancel, Icon=Info If Not IsDeclared("iMsgBoxAnswer") Then Dim $iMsgBoxAnswer $iMsgBoxAnswer = MsgBox(65, "Your Editing Options", "Your options are" & @CRLF & $options1 & @CRLF & "using these options will Edit, Grant and Enable Inherited permissions to " & $sFileLocation & " " & @CRLF & "for " & $sgroupuser & " If this is not correct then press Exit and rerun the program!") Select Case $iMsgBoxAnswer = 1 ;OK Case $iMsgBoxAnswer = 2 ;Cancel Exit EndSelect Case $options1 = "/e /g /i copy" ;MsgBox features: Title=Yes, Text=Yes, Buttons=OK and Cancel, Icon=Info If Not IsDeclared("iMsgBoxAnswer") Then Dim $iMsgBoxAnswer $iMsgBoxAnswer = MsgBox(65, "Your Editing Options", "Your options are" & @CRLF & $options1 & @CRLF & "using these options will Edit, Grant and Copy Inherited permissions to " & $sFileLocation & " " & "for " & $sgroupuser & @CRLF & " If this is not correct then press Exit and rerun the program!") Select Case $iMsgBoxAnswer = 1 ;OK Case $iMsgBoxAnswer = 2 ;Cancel Exit EndSelect Case $options1 = "/e /g /i remove" ;MsgBox features: Title=Yes, Text=Yes, Buttons=OK and Cancel, Icon=Info If Not IsDeclared("iMsgBoxAnswer") Then Dim $iMsgBoxAnswer $iMsgBoxAnswer = MsgBox(65, "Your Editing Options", "Your options are" & @CRLF & $options1 & @CRLF & "using these options will Edit, Grant and Remove Inherited permissions to " & $sFileLocation & " " & "for " & $sgroupuser & @CRLF & " If this is not correct then press Exit and rerun the program!") Select Case $iMsgBoxAnswer = 1 ;OK Case $iMsgBoxAnswer = 2 ;Cancel Exit EndSelect Case $options1 = "/e /r" ;MsgBox features: Title=Yes, Text=Yes, Buttons=OK and Cancel, Icon=Info If Not IsDeclared("iMsgBoxAnswer") Then Dim $iMsgBoxAnswer $iMsgBoxAnswer = MsgBox(65, "Your Editing Options", "Your options are" & @CRLF & $options1 & @CRLF & "using these options will Edit and revoke rights to " & $sFileLocation & " " & "for " & $sgroupuser & @CRLF & " If this is not correct then press Exit and rerun the program!") Select Case $iMsgBoxAnswer = 1 ;OK Case $iMsgBoxAnswer = 2 ;Cancel Exit EndSelect Case $options1 = "/e /r /i enable" ;MsgBox features: Title=Yes, Text=Yes, Buttons=OK and Cancel, Icon=Info If Not IsDeclared("iMsgBoxAnswer") Then Dim $iMsgBoxAnswer $iMsgBoxAnswer = MsgBox(65, "Your Editing Options", "Your options are" & @CRLF & $options1 & @CRLF & "using these options will Edit, Revoke and Enable Inherited permissions to " & $sFileLocation & " " & "for " & $sgroupuser & @CRLF & " If this is not correct then press Exit and rerun the program!") Select Case $iMsgBoxAnswer = 1 ;OK Case $iMsgBoxAnswer = 2 ;Cancel Exit EndSelect Case $options1 = "/e /r /i copy" ;MsgBox features: Title=Yes, Text=Yes, Buttons=OK and Cancel, Icon=Info If Not IsDeclared("iMsgBoxAnswer") Then Dim $iMsgBoxAnswer $iMsgBoxAnswer = MsgBox(65, "Your Editing Options", "Your options are" & @CRLF & $options1 & @CRLF & "using these options will Edit, Revoke and Copy Inherited permissions to " & $sFileLocation & " " & "for " & $sgroupuser & @CRLF & " If this is not correct then press Exit and rerun the program!") Select Case $iMsgBoxAnswer = 1 ;OK Case $iMsgBoxAnswer = 2 ;Cancel Exit EndSelect Case $options1 = "/e /r /i remove" ;MsgBox features: Title=Yes, Text=Yes, Buttons=OK and Cancel, Icon=Info If Not IsDeclared("iMsgBoxAnswer") Then Dim $iMsgBoxAnswer $iMsgBoxAnswer = MsgBox(65, "Your Editing Options", "Your options are" & @CRLF & $options1 & @CRLF & "using these options will Edit, Revoke and Remove Inherited permissions to " & $sFileLocation & " " & "for " & $sgroupuser & @CRLF & " If this is not correct then press Exit and rerun the program!") Select Case $iMsgBoxAnswer = 1 ;OK Case $iMsgBoxAnswer = 2 ;Cancel Exit EndSelect Case $options1 = "/e /d" ;MsgBox features: Title=Yes, Text=Yes, Buttons=OK and Cancel, Icon=Info If Not IsDeclared("iMsgBoxAnswer") Then Dim $iMsgBoxAnswer $iMsgBoxAnswer = MsgBox(65, "Your Editing Options", "Your options are" & @CRLF & $options1 & @CRLF & "using these options will Edit and Deny rights to " & $sFileLocation & " " & "for " & $sgroupuser & @CRLF & " If this is not correct then press Exit and rerun the program!") Select Case $iMsgBoxAnswer = 1 ;OK Case $iMsgBoxAnswer = 2 ;Cancel Exit EndSelect Case $options1 = "/e /d /i enable" ;MsgBox features: Title=Yes, Text=Yes, Buttons=OK and Cancel, Icon=Info If Not IsDeclared("iMsgBoxAnswer") Then Dim $iMsgBoxAnswer $iMsgBoxAnswer = MsgBox(65, "Your Editing Options", "Your options are" & @CRLF & $options1 & @CRLF & "using these options will Edit, Deny and Enable Inherited permissions to " & $sFileLocation & " " & "for " & $sgroupuser & @CRLF & " If this is not correct then press Exit and rerun the program!") Select Case $iMsgBoxAnswer = 1 ;OK Case $iMsgBoxAnswer = 2 ;Cancel Exit EndSelect Case $options1 = "/e /d /i copy" ;MsgBox features: Title=Yes, Text=Yes, Buttons=OK and Cancel, Icon=Info If Not IsDeclared("iMsgBoxAnswer") Then Dim $iMsgBoxAnswer $iMsgBoxAnswer = MsgBox(65, "Your Editing Options", "Your options are" & @CRLF & $options1 & @CRLF & "using these options will Edit, Deny and Copy Inherited permissions to " & $sFileLocation & " " & "for " & $sgroupuser & @CRLF & " If this is not correct then press Exit and rerun the program!") Select Case $iMsgBoxAnswer = 1 ;OK Case $iMsgBoxAnswer = 2 ;Cancel Exit EndSelect Case $options1 = "/e /d /i remove" ;MsgBox features: Title=Yes, Text=Yes, Buttons=OK and Cancel, Icon=Info If Not IsDeclared("iMsgBoxAnswer") Then Dim $iMsgBoxAnswer $iMsgBoxAnswer = MsgBox(65, "Your Editing Options", "Your options are" & @CRLF & $options1 & @CRLF & "using these options will Edit, Deny and Remove Inherited permissions to " & $sFileLocation & " " & "for " & $sgroupuser & @CRLF & " If this is not correct then press Exit and rerun the program!") Select Case $iMsgBoxAnswer = 1 ;OK Case $iMsgBoxAnswer = 2 ;Cancel Exit EndSelect Case $options1 = "/e /i enable" ;MsgBox features: Title=Yes, Text=Yes, Buttons=OK and Cancel, Icon=Info If Not IsDeclared("iMsgBoxAnswer") Then Dim $iMsgBoxAnswer $iMsgBoxAnswer = MsgBox(65, "Your Editing Options", "Your options are" & @CRLF & $options1 & @CRLF & "using these options will Edit, Enable Inherited permissions to " & $sFileLocation & " " & "for " & $sgroupuser & @CRLF & " If this is not correct then press Exit and rerun the program!") Select Case $iMsgBoxAnswer = 1 ;OK Case $iMsgBoxAnswer = 2 ;Cancel Exit EndSelect Case $options1 = "/e /i copy" ;MsgBox features: Title=Yes, Text=Yes, Buttons=OK and Cancel, Icon=Info If Not IsDeclared("iMsgBoxAnswer") Then Dim $iMsgBoxAnswer $iMsgBoxAnswer = MsgBox(65, "Your Editing Options", "Your options are" & @CRLF & $options1 & @CRLF & "using these options will Edit, and Copy Inherited permissions to " & $sFileLocation & " " & "for " & $sgroupuser & @CRLF & " If this is not correct then press Exit and rerun the program!") Select Case $iMsgBoxAnswer = 1 ;OK Case $iMsgBoxAnswer = 2 ;Cancel Exit EndSelect Case $options1 = "/e /i remove" ;MsgBox features: Title=Yes, Text=Yes, Buttons=OK and Cancel, Icon=Info If Not IsDeclared("iMsgBoxAnswer") Then Dim $iMsgBoxAnswer $iMsgBoxAnswer = MsgBox(65, "Your Editing Options", "Your options are" & @CRLF & $options1 & @CRLF & "using these options will Edit, and Remove Inherited permissions to " & $sFileLocation & " " & "for " & $sgroupuser & @CRLF & " If this is not correct then press Exit and rerun the program!") Select Case $iMsgBoxAnswer = 1 ;OK Case $iMsgBoxAnswer = 2 ;Cancel Exit EndSelect Case Else ;MsgBox features: Title=Yes, Text=Yes, Buttons=OK and Cancel, Icon=Critical If Not IsDeclared("iMsgBoxAnswer") Then Dim $iMsgBoxAnswer $iMsgBoxAnswer = MsgBox(17, "Possible Error", "The Program was unable to determine the options you have chosen for the specified path. When the script runs, it may create errors and not set the permissions correctly. You may want to exit and start over making sure the parameters are correct. To COntinue Press Ok to exit press Cancel.") Select Case $iMsgBoxAnswer = 1 ;OK Case $iMsgBoxAnswer = 2 ;Cancel Exit EndSelectEndSelect; Options #2 for deciding what the first options will act upon. Just a file? Just a folder? Subfolders? Traverse folders?; InputBox features: Title=Yes, Prompt=Yes, Default Text=NoIf Not IsDeclared("sFileLocation") Then Dim $options2$options2 = InputBox("Program Options", "Please type which ever options you would like using spaces between each one." & @CRLF & @CRLF & ":f This will change all file Permissions. IMPORTANT: When revoking rights, the : must be changed to a / with a space before it. If this not done, revoking rights will not work!" & @CRLF & @CRLF & "/s This will change all subfolders under the inputted directory but will NOT traverse subdirectories unless /t is also present. If filename is a directory, and /s is not used, nosubdirectories will be touched." & @CRLF & @CRLF & "/t Traverses each subdirectory" & @CRLF & @CRLF & "The default is for all subfolders and files with in the folders and subfolders.", ":f /s /t", " ", "450", "300", "-1", "-1")Select Case @error = 0 ;OK - The string returned is valid Case @error = 1 ;The Cancel button was pushed Exit Case @error = 3 ;The InputBox failed to open EndSelect; Options #2 for deciding what the first options will act upon. Just a file? Just a folder? Subfolders? Traverse folders?; Creates an error message if the user input is not known, and states that the script may not run correctly!Select Case $options2 = ":f" ;MsgBox features: Title=Yes, Text=Yes, Buttons=OK and Cancel, Icon=Info If Not IsDeclared("iMsgBoxAnswer") Then Dim $iMsgBoxAnswer $iMsgBoxAnswer = MsgBox(65, "Your File Options", "Your options are" & @CRLF & $options2 & @CRLF & "using these options will Edit only specific FILE permissions to " & $sFileLocation & " " & "for " & $sgroupuser & @CRLF & " If this is not correct then press Exit and rerun the program!") Select Case $iMsgBoxAnswer = 1 ;OK Case $iMsgBoxAnswer = 2 ;Cancel Exit EndSelect Case $options2 = " /f" ;MsgBox features: Title=Yes, Text=Yes, Buttons=OK and Cancel, Icon=Info If Not IsDeclared("iMsgBoxAnswer") Then Dim $iMsgBoxAnswer $iMsgBoxAnswer = MsgBox(65, "Your File Options", "Your options are" & @CRLF & $options2 & @CRLF & "using these options will Edit only specific FILE permissions to " & $sFileLocation & " " & "for " & $sgroupuser & @CRLF & " If this is not correct then press Exit and rerun the program!") Select Case $iMsgBoxAnswer = 1 ;OK Case $iMsgBoxAnswer = 2 ;Cancel Exit EndSelect Case $options2 = ":f /s" ;MsgBox features: Title=Yes, Text=Yes, Buttons=OK and Cancel, Icon=Info If Not IsDeclared("iMsgBoxAnswer") Then Dim $iMsgBoxAnswer $iMsgBoxAnswer = MsgBox(65, "Your File Options", "Your options are" & @CRLF & $options2 & @CRLF & "using these options will Edit FILE and Subdirectory permissions to " & $sFileLocation & " " & "for " & $sgroupuser & @CRLF & " If this is not correct then press Exit and rerun the program!") Select Case $iMsgBoxAnswer = 1 ;OK Case $iMsgBoxAnswer = 2 ;Cancel Exit EndSelect Case $options2 = " /f /s" ;MsgBox features: Title=Yes, Text=Yes, Buttons=OK and Cancel, Icon=Info If Not IsDeclared("iMsgBoxAnswer") Then Dim $iMsgBoxAnswer $iMsgBoxAnswer = MsgBox(65, "Your File Options", "Your options are" & @CRLF & $options2 & @CRLF & "using these options will Edit FILE and Subdirectory permissions to " & $sFileLocation & " " & "for " & $sgroupuser & @CRLF & " If this is not correct then press Exit and rerun the program!") Select Case $iMsgBoxAnswer = 1 ;OK Case $iMsgBoxAnswer = 2 ;Cancel Exit EndSelect Case $options2 = ":f /s /t" ;MsgBox features: Title=Yes, Text=Yes, Buttons=OK and Cancel, Icon=Info If Not IsDeclared("iMsgBoxAnswer") Then Dim $iMsgBoxAnswer $iMsgBoxAnswer = MsgBox(65, "Your File Options", "Your options are" & @CRLF & $options2 & @CRLF & "using these options will Edit FILE, Subdirectory permissions and will Traverse each subdirectory to " & $sFileLocation & " " & "for " & $sgroupuser & @CRLF & " If this is not correct then press Exit and rerun the program!") Select Case $iMsgBoxAnswer = 1 ;OK Case $iMsgBoxAnswer = 2 ;Cancel Exit EndSelect Case $options2 = " /f /s /t" ;MsgBox features: Title=Yes, Text=Yes, Buttons=OK and Cancel, Icon=Info If Not IsDeclared("iMsgBoxAnswer") Then Dim $iMsgBoxAnswer $iMsgBoxAnswer = MsgBox(65, "Your File Options", "Your options are" & @CRLF & $options2 & @CRLF & "using these options will Edit FILE, Subdirectory permissions and will Traverse each subdirectory to " & $sFileLocation & " " & "for " & $sgroupuser & @CRLF & " If this is not correct then press Exit and rerun the program!") Select Case $iMsgBoxAnswer = 1 ;OK Case $iMsgBoxAnswer = 2 ;Cancel Exit EndSelect Case $options2 = " /s" ;MsgBox features: Title=Yes, Text=Yes, Buttons=OK and Cancel, Icon=Info If Not IsDeclared("iMsgBoxAnswer") Then Dim $iMsgBoxAnswer $iMsgBoxAnswer = MsgBox(65, "Your File Options", "Your options are" & @CRLF & $options2 & @CRLF & "using these options will Edit only Subdirectory permissions to " & $sFileLocation & " " & "for " & $sgroupuser & @CRLF & " If this is not correct then press Exit and rerun the program!") Select Case $iMsgBoxAnswer = 1 ;OK Case $iMsgBoxAnswer = 2 ;Cancel Exit EndSelect Case $options2 = " /s /t" ;MsgBox features: Title=Yes, Text=Yes, Buttons=OK and Cancel, Icon=Info If Not IsDeclared("iMsgBoxAnswer") Then Dim $iMsgBoxAnswer $iMsgBoxAnswer = MsgBox(65, "Your File Options", "Your options are" & @CRLF & $options2 & @CRLF & "using these options will Edit Subdirectory and Traverse the permissions to " & $sFileLocation & " " & "for " & $sgroupuser & @CRLF & " If this is not correct then press Exit and rerun the program!") Select Case $iMsgBoxAnswer = 1 ;OK Case $iMsgBoxAnswer = 2 ;Cancel Exit EndSelect ;MsgBox features: Title=Yes, Text=Yes, Buttons=OK and Cancel, Icon=Critical Case Else If Not IsDeclared("iMsgBoxAnswer") Then Dim $iMsgBoxAnswer $iMsgBoxAnswer = MsgBox(17, "Possible Error", "The Program was unable to determine the options you have chosen for the specified path. When the script runs, it may create errors and not set the permissions correctly. You may want to exit and start over making sure the parameters are correct. To COntinue Press Ok to exit press Cancel.") Select Case $iMsgBoxAnswer = 1 ;OK Case $iMsgBoxAnswer = 2 ;Cancel Exit EndSelectEndSelect;Create a GUI innerface for Placement of user's LOG FileGUICreate("Log File", 250, 150)GUICtrlCreateLabel("Where would you like your Log file placed.", 10, 10)GUICtrlCreateLabel("Make sure the directory has NO Spaces.", 10, 25)GUICtrlCreateLabel("Correct = C:\Sample_Directory ", 10, 50)GUICtrlCreateLabel("Incorrect = C:\Sample Directory ", 10, 65)$okbutton2 = GUICtrlCreateButton("OK", 10, 110, 45, 20)$cancel2 = GUICtrlCreateButton("Cancel", 70, 110, 45, 20)$browse2 = GUICtrlCreateButton("Browse", 165, 80, 45, 20);Create input Box$input2 = GUICtrlCreateInput("", 10, 80, 140, 20)GUICtrlSetState(-1, $GUI_ACCEPTFILES); Show GUI, and wait for OK to be pressedGUISetState()While 1 $msg = GUIGetMsg() Select Case $msg = $GUI_EVENT_CLOSE Exit Case $msg = $okbutton2 ExitLoop Case $msg = $cancel2 ExitLoop Case $msg = $browse2 $logloc = FileSelectFolder("Select Folder", " ", "All (*.*)", 2) GUICtrlSetData($input2, $logloc) EndSelectWEndGUIDelete();Displays a message to the user of how the script will be placed in the CMD window.; Give the option to cancel the run.;MsgBox features: Title=Yes, Text=Yes, Buttons=OK and Cancel, Icon=NoneIf Not IsDeclared("iMsgBoxAnswer") Then Dim $iMsgBoxAnswer$iMsgBoxAnswer = MsgBox(1, "Selected Options", "The following line of script will run for xcacls.vbs" & @CRLF & @CRLF & "xcacls.vbs " & $sFileLocation & " " & $options1 & " " & $sgroupuser & $options2 & @CRLF & @CRLF & "Your Log file will be created in " & $logloc & "\user_group.log" & @CRLF & " If this is incorrect please Canel and start over!")Select Case $iMsgBoxAnswer = 1 ;OK Case $iMsgBoxAnswer = 2 ;Cancel ExitEndSelect; Creates the batch file user_group_rights.bat in the same directory of which the script will use to run the program.; I HAD TO MAKE THIS SECTION UNC TO GET IT TO RUN CORRECTLY!!!! YOU MAY NEED TO$batch = FileOpen("\\Server\Directory\user_group_rights.bat", 2)FileWrite($batch, "Cscript.exe /h:cscript" & @CRLF)FileWrite($batch, "\\Server\Directory\xcacls.vbs ")FileWrite($batch, $sFileLocation)FileWrite($batch, " " & $options1 & " " & $sgroupuser & $options2 & " /l" & " " & $logloc & "\user_group.log" & @CRLF)FileWrite($batch, "exit")FileClose($batch);Runs the batch file.If FileExists("\\Server\Directory\user_group_rights.bat") Then Run("\\Server\Directory\user_group_rights.bat")Else MsgBox(4096, "No file", "File does not exist") ExitEndIf;Wait until the CMD window is closed to continue XP,2003 MachinesIf WinActive("C:\WINDOWS\system32\cmd.exe") Then WinWaitClose("C:\WINDOWS\system32\cmd.exe")EndIf;Wait until the CMD window is closed to continue 2000, NT MachinesIf WinActive("C:\WINNT\system32\cmd.exe") Then WinWaitClose("C:\WINNT\system32\cmd.exe")EndIf;Once the CMD window is closed pop up a message stating the script has completed and to check the log file for Unsucsessful instances.;MsgBox features: Title=Yes, Text=Yes, Buttons=OK, Icon=InfoMsgBox(64, "Script Complete", "The script has completed please check the log file named user_group.log in the " & $logloc & " directory.")Exitxcalcs_filepermissionau3.zip Link to comment Share on other sites More sharing options...
Letraindusoir Posted May 14, 2019 Share Posted May 14, 2019 A good topic post, related to the discussion of system permissions, this kind of topic post is too few. More Thanks To Ben Sherrill. Link to comment Share on other sites More sharing options...
Moderators Melba23 Posted May 14, 2019 Moderators Share Posted May 14, 2019 Letraindusoir, You do realise this thread was started over 13 years ago! And that the OP has not been here for 12 years? Please do not necropost like this in future. M23 Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind Open spoiler to see my UDFs: Spoiler ArrayMultiColSort ---- Sort arrays on multiple columnsChooseFileFolder ---- Single and multiple selections from specified path treeview listingDate_Time_Convert -- Easily convert date/time formats, including the language usedExtMsgBox --------- A highly customisable replacement for MsgBoxGUIExtender -------- Extend and retract multiple sections within a GUIGUIFrame ---------- Subdivide GUIs into many adjustable framesGUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView itemsGUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeViewMarquee ----------- Scrolling tickertape GUIsNoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxesNotify ------------- Small notifications on the edge of the displayScrollbars ----------Automatically sized scrollbars with a single commandStringSize ---------- Automatically size controls to fit textToast -------------- Small GUIs which pop out of the notification area Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now