MMedina Posted July 22, 2018 Share Posted July 22, 2018 So I have a very simple Auotit script that is utilizing the Printbrm to export to a file but Cacls are not being changed...... Attached is the script: $sUser = "WTF" $sPass = "IsGoing" $sDomain = "OnHere" $sCMD = "C:\Windows\System32\spool\tools\Printbrm.exe /b /f C:\temp\Printers\backup.printerExport" $sCalc = "C:\Windows\System32\cacls C:\temp\Printers /t /e /g Everyone:f" DirCreate ("C:\Temp\Printers") RunAsWait ($sUser, $sDomain, $sPass, 0, "cmd /c " & $sCalc) RunAsWait ($sUser, $sDomain, $sPass, 0, "cmd /c " & $sCMD) Please any help will be grateful...... THANKS Link to comment Share on other sites More sharing options...
MMedina Posted July 22, 2018 Author Share Posted July 22, 2018 On 3/5/2013 at 10:36 AM, water said: Add #RequireAdmin at the top of your script and use Run to execute Cacls. So I have a very simple Auotit script that is utilizing the Printbrm to export to a file but Cacls are not being changed...... Attached is the script: $sUser = "WTF" $sPass = "IsGoing" $sDomain = "OnHere" $sCMD = "C:\Windows\System32\spool\tools\Printbrm.exe /b /f C:\temp\Printers\backup.printerExport" $sCalc = "C:\Windows\System32\cacls C:\temp\Printers /t /e /g Everyone:f" DirCreate ("C:\Temp\Printers") RunAsWait ($sUser, $sDomain, $sPass, 0, "cmd /c " & $sCalc) RunAsWait ($sUser, $sDomain, $sPass, 0, "cmd /c " & $sCMD) Link to comment Share on other sites More sharing options...
MMedina Posted July 22, 2018 Author Share Posted July 22, 2018 So I have a very simple Auotit script that is utilizing the Printbrm to export to a file but Cacls are not being changed...... Attached is the script: $sUser = "WTF" $sPass = "IsGoing" $sDomain = "OnHere" $sCMD = "C:\Windows\System32\spool\tools\Printbrm.exe /b /f C:\temp\Printers\backup.printerExport" $sCalc = "C:\Windows\System32\cacls C:\temp\Printers /t /e /g Everyone:f" DirCreate ("C:\Temp\Printers") RunAsWait ($sUser, $sDomain, $sPass, 0, "cmd /c " & $sCalc) RunAsWait ($sUser, $sDomain, $sPass, 0, "cmd /c " & $sCMD) Link to comment Share on other sites More sharing options...
MMedina Posted July 22, 2018 Author Share Posted July 22, 2018 So I have a very simple Auotit script that is utilizing the Printbrm to export to a file but Cacls are not being changed...... Attached is the script: $sUser = "WTF" $sPass = "IsGoing" $sDomain = "OnHere" $sCMD = "C:\Windows\System32\spool\tools\Printbrm.exe /b /f C:\temp\Printers\backup.printerExport" $sCalc = "C:\Windows\System32\cacls C:\temp\Printers /t /e /g Everyone:f" DirCreate ("C:\Temp\Printers") RunAsWait ($sUser, $sDomain, $sPass, 0, "cmd /c " & $sCalc) RunAsWait ($sUser, $sDomain, $sPass, 0, "cmd /c " & $sCMD) Link to comment Share on other sites More sharing options...
careca Posted July 22, 2018 Share Posted July 22, 2018 (edited) Why did you create another exact same thread? EDIT: is this for 2003 sp2 or Vista+? If it is they say you should use icacls instead. Edited July 22, 2018 by careca Spoiler Renamer - Rename files and folders, remove portions of text from the filename etc. GPO Tool - Export/Import Group policy settings. MirrorDir - Synchronize/Backup/Mirror Folders BeatsPlayer - Music player. Params Tool - Right click an exe to see it's parameters or execute them. String Trigger - Triggers pasting text or applications or internet links on specific strings. Inconspicuous - Hide files in plain sight, not fully encrypted. Regedit Control - Registry browsing history, quickly jump into any saved key. Time4Shutdown - Write the time for shutdown in minutes. Power Profiles Tool - Set a profile as active, delete, duplicate, export and import. Finished Task Shutdown - Shuts down pc when specified window/Wndl/process closes. NetworkSpeedShutdown - Shuts down pc if download speed goes under "X" Kb/s. IUIAutomation - Topic with framework and examples Au3Record.exe Link to comment Share on other sites More sharing options...
MMedina Posted July 22, 2018 Author Share Posted July 22, 2018 When I attempted the first time it said that the service wasn't available at the time. So I created a new one and they both appeared. Couldn't find a why to delete it. Link to comment Share on other sites More sharing options...
careca Posted July 22, 2018 Share Posted July 22, 2018 (edited) Ok np. Did you try any combination of single or double quotes on the paths? PS: and running as admin? Edited July 22, 2018 by careca Spoiler Renamer - Rename files and folders, remove portions of text from the filename etc. GPO Tool - Export/Import Group policy settings. MirrorDir - Synchronize/Backup/Mirror Folders BeatsPlayer - Music player. Params Tool - Right click an exe to see it's parameters or execute them. String Trigger - Triggers pasting text or applications or internet links on specific strings. Inconspicuous - Hide files in plain sight, not fully encrypted. Regedit Control - Registry browsing history, quickly jump into any saved key. Time4Shutdown - Write the time for shutdown in minutes. Power Profiles Tool - Set a profile as active, delete, duplicate, export and import. Finished Task Shutdown - Shuts down pc when specified window/Wndl/process closes. NetworkSpeedShutdown - Shuts down pc if download speed goes under "X" Kb/s. IUIAutomation - Topic with framework and examples Au3Record.exe Link to comment Share on other sites More sharing options...
MMedina Posted July 22, 2018 Author Share Posted July 22, 2018 I have tried so many variables I can not recall...... $sUser = "WTF", $sPass = "IsGoing", $sDomain = "OnHere" I am passing the cred to elevate to admin. The export of the printer is working fine however the Cacls are not changing as expected...... If I runas an admin and pass the arguements "C:\Windows\System32\cacls.exe C:\temp\Printers /t /e /g Everyone:f" It works fine $sUser = "WTF" $sPass = "IsGoing" $sDomain = "OnHere" $sCMD = "C:\Windows\System32\spool\tools\Printbrm.exe /b /f C:\temp\Printers\backup.printerExport" $sCalc = "C:\Windows\System32\cacls.exe C:\temp\Printers /t /e /g Everyone:f" DirCreate ("C:\Temp\Printers") RunAsWait ($sUser, $sDomain, $sPass, 0, "cmd /c " & $sCalc) RunAsWait ($sUser, $sDomain, $sPass, 0, "cmd /c " & $sCMD) Test3.au3 Link to comment Share on other sites More sharing options...
Developers Jos Posted July 22, 2018 Developers Share Posted July 22, 2018 Merged all three places you posted into this thread... lets try staying here now. Jos FrancescoDiMuro 1 SciTE4AutoIt3 Full installer Download page - Beta files Read before posting How to post scriptsource Forum etiquette Forum Rules Live for the present, Dream of the future, Learn from the past. Link to comment Share on other sites More sharing options...
spudw2k Posted July 23, 2018 Share Posted July 23, 2018 What is the return value and value of @error after your RunAsWait function call? Give this a read: https://www.autoitscript.com/forum/topic/160817-elevate-a-part-of-a-script-using-run-as/ Spoiler Things I've Made: Always On Top Tool ◊ AU History ◊ Deck of Cards ◊ HideIt ◊ ICU ◊ Icon Freezer ◊ Ipod Ejector ◊ Junos Configuration Explorer ◊ Link Downloader ◊ MD5 Folder Enumerator ◊ PassGen ◊ Ping Tool ◊ Quick NIC ◊ Read OCR ◊ RemoteIT ◊ SchTasksGui ◊ SpyCam ◊ System Scan Report Tool ◊ System UpTime ◊ Transparency Machine ◊ VMWare ESX Builder Misc Code Snippets: ADODB Example ◊ CheckHover ◊ Detect SafeMode ◊ DynEnumArray ◊ GetNetStatData ◊ HashArray ◊ IsBetweenDates ◊ Local Admins ◊ Make Choice ◊ Recursive File List ◊ Remove Sizebox Style ◊ Retrieve PNPDeviceID ◊ Retrieve SysListView32 Contents ◊ Set IE Homepage ◊ Tickle Expired Password ◊ Transpose Array Projects: Drive Space Usage GUI ◊ LEDkIT ◊ Plasma_kIt ◊ Scan Engine Builder ◊ SpeeDBurner ◊ SubnetCalc Cool Stuff: AutoItObject UDF ◊ Extract Icon From Proc ◊ GuiCtrlFontRotate ◊ Hex Edit Funcs ◊ Run binary ◊ Service_UDF Link to comment Share on other sites More sharing options...
MMedina Posted July 23, 2018 Author Share Posted July 23, 2018 20 hours ago, spudw2k said: What is the return value and value of @error after your RunAsWait function call? Give this a read: https://www.autoitscript.com/forum/topic/160817-elevate-a-part-of-a-script-using-run-as/ I am a newbie at this so apologies from the start.... so are you asking me to run this: RunAsWait ($sUser, $sDomain, $sPass, 0, "cmd /c " & $sCalc @error) Link to comment Share on other sites More sharing options...
spudw2k Posted July 23, 2018 Share Posted July 23, 2018 I was thinking of something like this: ;untested $iRtn = RunAsWait ($sUser, $sDomain, $sPass, 0, "cmd /c " & $sCalc) ConsoleWrite("Return Value: " & $iRtn & @CRLF & "@error Value: " & @error) That article I linked to has some info in regards to RunAsWait not doing automatic process elevation. Spoiler Things I've Made: Always On Top Tool ◊ AU History ◊ Deck of Cards ◊ HideIt ◊ ICU ◊ Icon Freezer ◊ Ipod Ejector ◊ Junos Configuration Explorer ◊ Link Downloader ◊ MD5 Folder Enumerator ◊ PassGen ◊ Ping Tool ◊ Quick NIC ◊ Read OCR ◊ RemoteIT ◊ SchTasksGui ◊ SpyCam ◊ System Scan Report Tool ◊ System UpTime ◊ Transparency Machine ◊ VMWare ESX Builder Misc Code Snippets: ADODB Example ◊ CheckHover ◊ Detect SafeMode ◊ DynEnumArray ◊ GetNetStatData ◊ HashArray ◊ IsBetweenDates ◊ Local Admins ◊ Make Choice ◊ Recursive File List ◊ Remove Sizebox Style ◊ Retrieve PNPDeviceID ◊ Retrieve SysListView32 Contents ◊ Set IE Homepage ◊ Tickle Expired Password ◊ Transpose Array Projects: Drive Space Usage GUI ◊ LEDkIT ◊ Plasma_kIt ◊ Scan Engine Builder ◊ SpeeDBurner ◊ SubnetCalc Cool Stuff: AutoItObject UDF ◊ Extract Icon From Proc ◊ GuiCtrlFontRotate ◊ Hex Edit Funcs ◊ Run binary ◊ Service_UDF 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