snapo84 Posted April 7, 2017 Posted April 7, 2017 (edited) Hello AutoIT guy's... I did try now everything for my software deploy (still could put everything in one binary... but that shouldnt be necessary). As soon as i start an application deployment that calls a batch and inside the batch is a autoit script it shows the window of the script. Even if it is set to hidden in the deployment. So i got already ridd of the tasklist symbol, but how can i remove that not even a window is shown while the deployment is going on as "SYSTEM"? Those are the settings i use... Opt("GUICloseOnESC", 0) ;1=ESC closes, 0=ESC won't close Opt("GUICoordMode", 1) ;1=absolute, 0=relative, 2=cell Opt("GUIDataSeparatorChar", "|") ;"|" is the default Opt("GUIOnEventMode", 0) ;0=disabled, 1=OnEvent mode enabled Opt("GUIResizeMode", 0) ;0=no resizing, <1024 special resizing Opt("GUIEventOptions", 0) ;0=default, 1=just notification, 2=GUICtrlRead tab index Opt("TrayAutoPause", 0) ;0=no pause, 1=Pause Opt("TrayIconDebug", 0) ;0=no info, 1=debug line info Opt("TrayIconHide", 1) ;0=show, 1=hide tray icon Opt("TrayMenuMode", 1) ;0=append, 1=no default menu, 2=no automatic check, 4=menuitemID not return Opt("TrayOnEventMode", 0) ;0=disable, 1=enable Opt("SendAttachMode", 0) ;0=don't attach, 1=do attach So i was thinking to either make it fully transparent, or at least minimize it.... Thanks a lot Edited April 7, 2017 by snapo84
snapo84 Posted April 7, 2017 Author Posted April 7, 2017 (edited) expandcollapse popupFunc main() _startCheck() _checkOldOffice() ConsoleWrite("We see Office 2013 installed True? " & $oldOffice & @CRLF) Switch $Param1 Case "switch" _readActualData() If ($platformCurrentOffice = 64) Then $platformCurrentOffice = 32 $finalPathOffice = StringReplace($finalPathOffice, "64", "32") Else $platformCurrentOffice = 64 $finalPathOffice = StringReplace($finalPathOffice, "32", "64") EndIf $oldOffice = 0 _getFastestDistributionpoint() _getAllFoldersOffice365() Global $templang = $languagesCurrentlyInstalled Global $tempvisio = $visioCurrentlyInstalled Global $tempproject = $projectCurrentlyInstalled Global $tempplatform = $platformCurrentOffice Global $tempofficeversionu = $oldOffice _Log() _uninstallEverything() _executeConfig() $oldOffice = $tempofficeversionu $languagesCurrentlyInstalled = $templang $visioCurrentlyInstalled = $tempvisio $projectCurrentlyInstalled = $tempproject FileDelete($MaintenanceFolder & "\OfficeCache\office.xml") _createConfigXMLaddLangorProduct() _executeConfig() _Log() ;~ ConsoleWrite("switch" & @CRLF) Case "install" Switch $Param2 Case "project" _readActualData() _getFastestDistributionpoint() _getAllFoldersOffice365() $projectCurrentlyInstalled = "1" _createConfigXMLaddLangorProduct() _executeConfig() _Log() ;~ ConsoleWrite("ipro" & @CRLF) Case "projects" _readActualData() _getFastestDistributionpoint() _getAllFoldersOffice365() $projectCurrentlyInstalled = "1" _createConfigXMLaddLangorProduct() _executeConfig() _Log() ;~ ConsoleWrite("ipro" & @CRLF) Case "visio" _readActualData() _getFastestDistributionpoint() _getAllFoldersOffice365() $visioCurrentlyInstalled = "1" _createConfigXMLaddLangorProduct() _executeConfig() _Log() ;~ ConsoleWrite("ivisio" & @CRLF) Case "office" _readActualData() _getFastestDistributionpoint() _getAllFoldersOffice365() $officeCurrentlyInstalled = "1" _createConfigXMLaddLangorProduct() _executeConfig() _Log() ;~ ConsoleWrite("ioffice" & @CRLF) EndSwitch Case "uninstall" Switch $Param2 Case "project" _readActualData() _getFastestDistributionpoint() _getAllFoldersOffice365() $uninstallOffice = "0" $uninstallProjects = "1" $uninstallVisio = "0" _createConfigXMLUninstallProduct() _executeConfig() _Log() ;~ ConsoleWrite("upro" & @CRLF) Case "projects" _readActualData() _getFastestDistributionpoint() _getAllFoldersOffice365() $uninstallOffice = "0" $uninstallProjects = "1" $uninstallVisio = "0" _createConfigXMLUninstallProduct() _executeConfig() _Log() ;~ ConsoleWrite("upro" & @CRLF) Case "visio" _readActualData() _getFastestDistributionpoint() _getAllFoldersOffice365() $uninstallOffice = "0" $uninstallProjects = "0" $uninstallVisio = "1" _createConfigXMLUninstallProduct() _executeConfig() _Log() ;~ ConsoleWrite("uvisio" & @CRLF) Case "office" _readActualData() _getFastestDistributionpoint() _getAllFoldersOffice365() $uninstallOffice = "1" $uninstallProjects = "0" $uninstallVisio = "0" _createConfigXMLUninstallProduct() _executeConfig() _Log() ;~ ConsoleWrite("uo" & @CRLF) EndSwitch Case "addlang" _readActualData() _getFastestDistributionpoint() _getAllFoldersOffice365() _createConfigXMLaddLangorProduct() _executeConfig() _Log() ConsoleWrite("addlang" & @CRLF) Case "remlang" _readActualData() _getFastestDistributionpoint() _getAllFoldersOffice365() $uninstallOffice = "1" $uninstallProjects = "1" $uninstallVisio = "1" _createConfigXMLUninstallProduct() _executeConfig() _Log() ;~ ConsoleWrite("remlang" & @CRLF) Case "base" $officeCurrentlyInstalled = "1" $languagesCurrentlyInstalled = "" $platformCurrentOffice = "64" $visioCurrentlyInstalled = "0" $projectCurrentlyInstalled = "0" $currentOfficeVersion = "1.0.0.0" _base() _createConfigXMLaddLangorProduct() _executeConfig() _Log() ;~ ConsoleWrite("base" & @CRLF) Case "clean" $oldOffice = 0 _readActualData() _getFastestDistributionpoint() _getAllFoldersOffice365() _uninstallEverything() _executeConfig() _Log() _getAllFoldersOffice365() _determineLangFromPCName() $oldOffice = 1 _readActualData() _getFastestDistributionpoint() _getAllFoldersOffice365() _uninstallEverything() _executeConfig() _Log() ;~ $officeCurrentlyInstalled = "1" $visioCurrentlyInstalled = "0" $projectCurrentlyInstalled = "0" $officeCurrentlyInstalled = "1" $languagesCurrentlyInstalled = "" $platformCurrentOffice = "32" $currentOfficeVersion = "1.0.0.0" $oldOffice = 0 _determineLangFromPCName() _getFastestDistributionpoint() _getAllFoldersOffice365() _createConfigXMLaddLangorProduct() _executeConfig() _Log() ;~ ConsoleWrite("base" & @CRLF) Case "upgrade" _readActualData() $oldOffice = 1 Global $tempvisiou = $visioCurrentlyInstalled Global $tempprojectu = $projectCurrentlyInstalled _getFastestDistributionpoint() _getAllFoldersOffice365() $uninstallOffice = "0" $uninstallProjects = "1" $uninstallVisio = "1" If ($tempvisiou = "1" Or $tempprojectu = "1") Then _createConfigXMLUninstallProduct() _executeConfig() _Log() EndIf _readActualData() _determineLangFromPCName() $oldOffice = 0 $visioCurrentlyInstalled = $tempvisiou $projectCurrentlyInstalled = $tempprojectu _getFastestDistributionpoint() _getAllFoldersOffice365() _createConfigXMLaddLangorProduct() _executeConfig() _Log() ConsoleWrite("upgrade" & @CRLF) Case "downgrade" _readActualData() _getFastestDistributionpoint() _getAllFoldersOffice365() Global $templang = $languagesCurrentlyInstalled Global $tempvisio = $visioCurrentlyInstalled Global $tempproject = $projectCurrentlyInstalled Global $tempplatform = $platformCurrentOffice Global $tempofficeversionu = $oldOffice _Log() _uninstallEverything() _executeConfig() $oldOffice = 1 $languagesCurrentlyInstalled = $templang $visioCurrentlyInstalled = $tempvisio $projectCurrentlyInstalled = $tempproject $platformCurrentOffice = $tempplatform _getAllFoldersOffice365() FileDelete($MaintenanceFolder & "\OfficeCache\office.xml") _createConfigXMLaddLangorProduct() _executeConfig() _Log() ConsoleWrite("downgrade" & @CRLF) Case Else ConsoleWrite("Sorry we cant recognize Parameter 1" & @CRLF) EndSwitch _endCheck() EndFunc ;==>main This is my main function, as you can see i use parameters to for the office 2016 deployment.... at the top of the 1500 lines of code are only the global variables which are corporate specific and i cant share. after that only the main() is called Completly at the start i have those Opt Opt("GUICloseOnESC", 0) ;1=ESC closes, 0=ESC won't close Opt("GUICoordMode", 1) ;1=absolute, 0=relative, 2=cell Opt("GUIDataSeparatorChar", "|") ;"|" is the default Opt("GUIOnEventMode", 0) ;0=disabled, 1=OnEvent mode enabled Opt("GUIResizeMode", 0) ;0=no resizing, <1024 special resizing Opt("GUIEventOptions", 0) ;0=default, 1=just notification, 2=GUICtrlRead tab index Opt("TrayAutoPause", 0) ;0=no pause, 1=Pause Opt("TrayIconDebug", 0) ;0=no info, 1=debug line info Opt("TrayIconHide", 1) ;0=show, 1=hide tray icon Opt("TrayMenuMode", 1) ;0=append, 1=no default menu, 2=no automatic check, 4=menuitemID not return Opt("TrayOnEventMode", 0) ;0=disable, 1=enable Opt("SendAttachMode", 0) ;0=don't attach, 1=do attach Did try it with compile in 64 and 32bit Did try it with compile as console application.... already minimizing the window of the application itself would help a lot Edited April 7, 2017 by snapo84 missed some information
Subz Posted April 7, 2017 Posted April 7, 2017 Did you try #NoTrayIcon at the top of your script? Couple of pointers, Global scope shouldn't be used in functions, I'm not sure why you require a batch file as AutoIt can run directly from within SCCM. I'm also unsure why you need to specify distribution points as SCCM should automatically direct the client to the closest DP based upon SCCM Boundaries.
snapo84 Posted April 7, 2017 Author Posted April 7, 2017 Hi Subz, Thanks for the answer, i did try the NoTrayIcon, still same behavior... Also thanks a lot for the input on the global's inside a function wasnt aware of that and will try to not use them anymore... we have only one sccm management point globally and 5 DP's directly connected to them, from those five DP we have 32 pull DP's. For the office installer i ping them all to know which one is the fastest server as the sources are changed dynamically. I have to point out here that we have extremely slow network links. The problem is not getting the right location, the problem is if i create in sccm a application (application just starts a batch for installation) and inside this batch i call the autoit script. Probably i have to change it to all autoit as it seems start /wait "" is messing things up. I did use a batch because whith this i also have a pre-script and a post-script without having to compile the autoit script again on small changes. if i execute the autoit script directly from the sccm there is no problem... only if i use the batch.. thats why i did want to know of a method to hide it from the screen as with powershell app deployment all system application gui's get transfered to the users session. As it seems it is not possible with auto it to set those settings, so i will include everything in the autoit script and have to recompile it everytime there is a change... Thanks...
Subz Posted April 7, 2017 Posted April 7, 2017 Normally I use an Ini file to store all my information, then using one compiled script I access that information so if any changes are required I just update the ini file without having to manage the compiled script. For example in the following ini, I would read OfficeExecute which gives me the section name for the install information [Install Microsoft Office 2016], I then read that section into an Array. Using the key name, I then check [Queries] section Key Name if it returns True, I execute the Value. Anyway I found this method was easier to update the Ini rather than re-compling each time for small changes. [Microsoft Office 2016] OfficeExcute = Install Microsoft Office 2016 VisoProExecute = Install Microsoft Visio Pro 2016 VisoStdExecute = Install Microsoft Visio Std 2016 [Install Microsoft Office 2016] Qry01 = RunWait("Microsoft Office 2016 Pre-Req.exe", "", @SW_HIDE) Qry02 = RunWait("Microsoft Office 2016.exe", "", @SW_HIDE) Qry03 = RunWait("Microsoft Office 2016 Post-Req.exe", "", @SW_HIDE) [Install Microsoft Visio Pro 2016] Qry04 = RunWait("Microsoft Visio Pro 2016 Pre-Req.exe", "", @SW_HIDE) Qry05 = RunWait("Microsoft Visio Pro 2016.exe", "", @SW_HIDE) Qry06 = RunWait("Microsoft Visio Pro 2016 Post-Req.exe", "", @SW_HIDE) [Install Microsoft Visio Std 2016] Qry07 = RunWait("Microsoft Visio Std 2016 Pre-Req.exe", "", @SW_HIDE) Qry08 = RunWait("Microsoft Visio Std 2016.exe", "", @SW_HIDE) Qry09 = RunWait("Microsoft Visio Std 2016 Post-Req.exe", "", @SW_HIDE) [Queries] Qry01 = @OSArch = "x64" And RegRead("HKLM\Software\..", "") Or FileExists("Filename.ext") Qry02 = @OSArch = "x64" And RegRead("HKLM\Software\..", "") Or FileExists("Filename.ext") Qry03 = @OSArch = "x64" And RegRead("HKLM\Software\..", "") Or FileExists("Filename.ext") Qry04 = @OSArch = "x64" And RegRead("HKLM\Software\..", "") Or FileExists("Filename.ext") Qry05 = @OSArch = "x64" And RegRead("HKLM\Software\..", "") Or FileExists("Filename.ext") Qry06 = @OSArch = "x64" And RegRead("HKLM\Software\..", "") Or FileExists("Filename.ext") Qry07 = @OSArch = "x64" And RegRead("HKLM\Software\..", "") Or FileExists("Filename.ext") Qry08 = @OSArch = "x64" And RegRead("HKLM\Software\..", "") Or FileExists("Filename.ext") Qry09 = @OSArch = "x64" And RegRead("HKLM\Software\..", "") Or FileExists("Filename.ext") snapo84 1
snapo84 Posted April 7, 2017 Author Posted April 7, 2017 Hey Subz, Thanks a lot, i really like the way you think :-) i wasnt aware that i can use functions inside the ini file, as in the early days of batch and vbscript you had to use delayed expansion ;=) That opens much more flexibility. After that i can simply for ubound the array and set all key's as required. *omg* I really appreciate your help!!!!! thanks a thousand times
Subz Posted April 7, 2017 Posted April 7, 2017 No problem, just use Execute() function in your compiled script for executing strings for example: Execute(IniRead(@ScriptDir & "\FileName.ini", "Queries", "Qry01", False)) Anyway hope that helps, also welcome to AutoIt
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