Helen Posted October 12, 2012 Share Posted October 12, 2012 Hi all, Im having a problem with renaming files in System32 folder. I am trying to create an installation package that will also sort out errors, one of the packages I am installing has a dependecy in the system32\drivers folder, and no matter what I try - #requireadmin, it just wont play ball. Do any of you know how to get around this? All I want to do is either delete or rename a .sys file from Lumension (Ugh!) so the agent can be reinstalled. Kind Regards, Helen. Link to comment Share on other sites More sharing options...
guinness Posted October 12, 2012 Share Posted October 12, 2012 What does IsAdmin return? UDF List: _AdapterConnections() • _AlwaysRun() • _AppMon() • _AppMonEx() • _ArrayFilter/_ArrayReduce • _BinaryBin() • _CheckMsgBox() • _CmdLineRaw() • _ContextMenu() • _ConvertLHWebColor()/_ConvertSHWebColor() • _DesktopDimensions() • _DisplayPassword() • _DotNet_Load()/_DotNet_Unload() • _Fibonacci() • _FileCompare() • _FileCompareContents() • _FileNameByHandle() • _FilePrefix/SRE() • _FindInFile() • _GetBackgroundColor()/_SetBackgroundColor() • _GetConrolID() • _GetCtrlClass() • _GetDirectoryFormat() • _GetDriveMediaType() • _GetFilename()/_GetFilenameExt() • _GetHardwareID() • _GetIP() • _GetIP_Country() • _GetOSLanguage() • _GetSavedSource() • _GetStringSize() • _GetSystemPaths() • _GetURLImage() • _GIFImage() • _GoogleWeather() • _GUICtrlCreateGroup() • _GUICtrlListBox_CreateArray() • _GUICtrlListView_CreateArray() • _GUICtrlListView_SaveCSV() • _GUICtrlListView_SaveHTML() • _GUICtrlListView_SaveTxt() • _GUICtrlListView_SaveXML() • _GUICtrlMenu_Recent() • _GUICtrlMenu_SetItemImage() • _GUICtrlTreeView_CreateArray() • _GUIDisable() • _GUIImageList_SetIconFromHandle() • _GUIRegisterMsg() • _GUISetIcon() • _Icon_Clear()/_Icon_Set() • _IdleTime() • _InetGet() • _InetGetGUI() • _InetGetProgress() • _IPDetails() • _IsFileOlder() • _IsGUID() • _IsHex() • _IsPalindrome() • _IsRegKey() • _IsStringRegExp() • _IsSystemDrive() • _IsUPX() • _IsValidType() • _IsWebColor() • _Language() • _Log() • _MicrosoftInternetConnectivity() • _MSDNDataType() • _PathFull/GetRelative/Split() • _PathSplitEx() • _PrintFromArray() • _ProgressSetMarquee() • _ReDim() • _RockPaperScissors()/_RockPaperScissorsLizardSpock() • _ScrollingCredits • _SelfDelete() • _SelfRename() • _SelfUpdate() • _SendTo() • _ShellAll() • _ShellFile() • _ShellFolder() • _SingletonHWID() • _SingletonPID() • _Startup() • _StringCompact() • _StringIsValid() • _StringRegExpMetaCharacters() • _StringReplaceWholeWord() • _StringStripChars() • _Temperature() • _TrialPeriod() • _UKToUSDate()/_USToUKDate() • _WinAPI_Create_CTL_CODE() • _WinAPI_CreateGUID() • _WMIDateStringToDate()/_DateToWMIDateString() • Au3 script parsing • AutoIt Search • AutoIt3 Portable • AutoIt3WrapperToPragma • AutoItWinGetTitle()/AutoItWinSetTitle() • Coding • DirToHTML5 • FileInstallr • FileReadLastChars() • GeoIP database • GUI - Only Close Button • GUI Examples • GUICtrlDeleteImage() • GUICtrlGetBkColor() • GUICtrlGetStyle() • GUIEvents • GUIGetBkColor() • Int_Parse() & Int_TryParse() • IsISBN() • LockFile() • Mapping CtrlIDs • OOP in AutoIt • ParseHeadersToSciTE() • PasswordValid • PasteBin • Posts Per Day • PreExpand • Protect Globals • Queue() • Resource Update • ResourcesEx • SciTE Jump • Settings INI • SHELLHOOK • Shunting-Yard • Signature Creator • Stack() • Stopwatch() • StringAddLF()/StringStripLF() • StringEOLToCRLF() • VSCROLL • WM_COPYDATA • More Examples... Updated: 22/04/2018 Link to comment Share on other sites More sharing options...
Helen Posted October 12, 2012 Author Share Posted October 12, 2012 Is admin returns 1, Im logged on and running as Domain Admin as well, so cant understand why not working Link to comment Share on other sites More sharing options...
Helen Posted October 12, 2012 Author Share Posted October 12, 2012 And in addition, I have tried to use filexists ("C:\Windows\System32\Driverseps.sys") but it cant find the file either when ran. Link to comment Share on other sites More sharing options...
guinness Posted October 12, 2012 Share Posted October 12, 2012 What does FileMove return? What version of AutoIt are you using? Maybe it will have to be done at login? UDF List: _AdapterConnections() • _AlwaysRun() • _AppMon() • _AppMonEx() • _ArrayFilter/_ArrayReduce • _BinaryBin() • _CheckMsgBox() • _CmdLineRaw() • _ContextMenu() • _ConvertLHWebColor()/_ConvertSHWebColor() • _DesktopDimensions() • _DisplayPassword() • _DotNet_Load()/_DotNet_Unload() • _Fibonacci() • _FileCompare() • _FileCompareContents() • _FileNameByHandle() • _FilePrefix/SRE() • _FindInFile() • _GetBackgroundColor()/_SetBackgroundColor() • _GetConrolID() • _GetCtrlClass() • _GetDirectoryFormat() • _GetDriveMediaType() • _GetFilename()/_GetFilenameExt() • _GetHardwareID() • _GetIP() • _GetIP_Country() • _GetOSLanguage() • _GetSavedSource() • _GetStringSize() • _GetSystemPaths() • _GetURLImage() • _GIFImage() • _GoogleWeather() • _GUICtrlCreateGroup() • _GUICtrlListBox_CreateArray() • _GUICtrlListView_CreateArray() • _GUICtrlListView_SaveCSV() • _GUICtrlListView_SaveHTML() • _GUICtrlListView_SaveTxt() • _GUICtrlListView_SaveXML() • _GUICtrlMenu_Recent() • _GUICtrlMenu_SetItemImage() • _GUICtrlTreeView_CreateArray() • _GUIDisable() • _GUIImageList_SetIconFromHandle() • _GUIRegisterMsg() • _GUISetIcon() • _Icon_Clear()/_Icon_Set() • _IdleTime() • _InetGet() • _InetGetGUI() • _InetGetProgress() • _IPDetails() • _IsFileOlder() • _IsGUID() • _IsHex() • _IsPalindrome() • _IsRegKey() • _IsStringRegExp() • _IsSystemDrive() • _IsUPX() • _IsValidType() • _IsWebColor() • _Language() • _Log() • _MicrosoftInternetConnectivity() • _MSDNDataType() • _PathFull/GetRelative/Split() • _PathSplitEx() • _PrintFromArray() • _ProgressSetMarquee() • _ReDim() • _RockPaperScissors()/_RockPaperScissorsLizardSpock() • _ScrollingCredits • _SelfDelete() • _SelfRename() • _SelfUpdate() • _SendTo() • _ShellAll() • _ShellFile() • _ShellFolder() • _SingletonHWID() • _SingletonPID() • _Startup() • _StringCompact() • _StringIsValid() • _StringRegExpMetaCharacters() • _StringReplaceWholeWord() • _StringStripChars() • _Temperature() • _TrialPeriod() • _UKToUSDate()/_USToUKDate() • _WinAPI_Create_CTL_CODE() • _WinAPI_CreateGUID() • _WMIDateStringToDate()/_DateToWMIDateString() • Au3 script parsing • AutoIt Search • AutoIt3 Portable • AutoIt3WrapperToPragma • AutoItWinGetTitle()/AutoItWinSetTitle() • Coding • DirToHTML5 • FileInstallr • FileReadLastChars() • GeoIP database • GUI - Only Close Button • GUI Examples • GUICtrlDeleteImage() • GUICtrlGetBkColor() • GUICtrlGetStyle() • GUIEvents • GUIGetBkColor() • Int_Parse() & Int_TryParse() • IsISBN() • LockFile() • Mapping CtrlIDs • OOP in AutoIt • ParseHeadersToSciTE() • PasswordValid • PasteBin • Posts Per Day • PreExpand • Protect Globals • Queue() • Resource Update • ResourcesEx • SciTE Jump • Settings INI • SHELLHOOK • Shunting-Yard • Signature Creator • Stack() • Stopwatch() • StringAddLF()/StringStripLF() • StringEOLToCRLF() • VSCROLL • WM_COPYDATA • More Examples... Updated: 22/04/2018 Link to comment Share on other sites More sharing options...
Helen Posted October 12, 2012 Author Share Posted October 12, 2012 Filemove also doesnt work, using SciTE Version 3.2.0. Partial Code is below: #RequireAdmin $sFile = "system32eps.sys" $sFile1 = "System32driverseps.sys" $Lumeps = @WindowsDir & $sFile $Lumeps32 = @WindowsDir & $sFile1 Func Lumeneps() FileDelete($Lumeps) Sleep(500) FileDelete($Lumeps32) Sleep(500) FileCopy("C:SwinstSwinst.exe", "C:ProgramDataMicrosoftWindowsStart MenuProgramsStartupSwinst.exe") FileCopy("C:SwinstSwinst.exe", "C:Documents and SettingsAll usersStart MenuProgramsStartupSwinst.exe") MsgBox(1, "Wait", "Waiting for checks") RegWrite("HKEY_LOCAL_MACHINESOFTWARESwinton", "Lumen", "Reg_DWORD", "1") Shutdown(6) ;Force a reboot EndFunc ;==>Lumeneps Link to comment Share on other sites More sharing options...
Helen Posted October 12, 2012 Author Share Posted October 12, 2012 I have also tried Filerecycle, this dont work either. Is the system32 folder protected by default in autoit? Link to comment Share on other sites More sharing options...
guinness Posted October 12, 2012 Share Posted October 12, 2012 (edited) Give this a try >> Note: You will need to download WinAPIEx and place all the relevant files in your include folder. #include <APIConstants.au3> ; Included with WinAPIEx.au3 #include <WinAPIEx.au3> ; Download From http://www.autoitscript.com/forum/topic/98712-winapiex-udf/ by Yashied. ConsoleWrite(_FileMoveEx('C:Example.dat', 'C:Example_Ex.dat') & @CRLF) Func _FileMoveEx($sSourcePath, $sDestinationPath, $iFlag = 0) Local $iReturn = FileMove($sSourcePath, $sDestinationPath, $iFlag) If $iReturn Then Return $iReturn EndIf Local $sDestinationFolder = _WinAPI_PathRemoveFileSpec($sDestinationPath) If BitAND($iFlag, 8) And FileExists($sDestinationFolder) = 0 Then DirCreate($sDestinationFolder) If BitAND($iFlag, 1) Then $iFlag = $MOVEFILE_REPLACE_EXISTING Else $iFlag = 0 Endif Return _WinAPI_MoveFileEx(FileGetShortName($sSourcePath), FileGetShortName($sDestinationPath), Bitor($iFlag, $MOVE_FILE_DELAY_UNTIL_REBOOT)) EndFunc ;==>_FileMoveEx Edited October 12, 2012 by guinness UDF List: _AdapterConnections() • _AlwaysRun() • _AppMon() • _AppMonEx() • _ArrayFilter/_ArrayReduce • _BinaryBin() • _CheckMsgBox() • _CmdLineRaw() • _ContextMenu() • _ConvertLHWebColor()/_ConvertSHWebColor() • _DesktopDimensions() • _DisplayPassword() • _DotNet_Load()/_DotNet_Unload() • _Fibonacci() • _FileCompare() • _FileCompareContents() • _FileNameByHandle() • _FilePrefix/SRE() • _FindInFile() • _GetBackgroundColor()/_SetBackgroundColor() • _GetConrolID() • _GetCtrlClass() • _GetDirectoryFormat() • _GetDriveMediaType() • _GetFilename()/_GetFilenameExt() • _GetHardwareID() • _GetIP() • _GetIP_Country() • _GetOSLanguage() • _GetSavedSource() • _GetStringSize() • _GetSystemPaths() • _GetURLImage() • _GIFImage() • _GoogleWeather() • _GUICtrlCreateGroup() • _GUICtrlListBox_CreateArray() • _GUICtrlListView_CreateArray() • _GUICtrlListView_SaveCSV() • _GUICtrlListView_SaveHTML() • _GUICtrlListView_SaveTxt() • _GUICtrlListView_SaveXML() • _GUICtrlMenu_Recent() • _GUICtrlMenu_SetItemImage() • _GUICtrlTreeView_CreateArray() • _GUIDisable() • _GUIImageList_SetIconFromHandle() • _GUIRegisterMsg() • _GUISetIcon() • _Icon_Clear()/_Icon_Set() • _IdleTime() • _InetGet() • _InetGetGUI() • _InetGetProgress() • _IPDetails() • _IsFileOlder() • _IsGUID() • _IsHex() • _IsPalindrome() • _IsRegKey() • _IsStringRegExp() • _IsSystemDrive() • _IsUPX() • _IsValidType() • _IsWebColor() • _Language() • _Log() • _MicrosoftInternetConnectivity() • _MSDNDataType() • _PathFull/GetRelative/Split() • _PathSplitEx() • _PrintFromArray() • _ProgressSetMarquee() • _ReDim() • _RockPaperScissors()/_RockPaperScissorsLizardSpock() • _ScrollingCredits • _SelfDelete() • _SelfRename() • _SelfUpdate() • _SendTo() • _ShellAll() • _ShellFile() • _ShellFolder() • _SingletonHWID() • _SingletonPID() • _Startup() • _StringCompact() • _StringIsValid() • _StringRegExpMetaCharacters() • _StringReplaceWholeWord() • _StringStripChars() • _Temperature() • _TrialPeriod() • _UKToUSDate()/_USToUKDate() • _WinAPI_Create_CTL_CODE() • _WinAPI_CreateGUID() • _WMIDateStringToDate()/_DateToWMIDateString() • Au3 script parsing • AutoIt Search • AutoIt3 Portable • AutoIt3WrapperToPragma • AutoItWinGetTitle()/AutoItWinSetTitle() • Coding • DirToHTML5 • FileInstallr • FileReadLastChars() • GeoIP database • GUI - Only Close Button • GUI Examples • GUICtrlDeleteImage() • GUICtrlGetBkColor() • GUICtrlGetStyle() • GUIEvents • GUIGetBkColor() • Int_Parse() & Int_TryParse() • IsISBN() • LockFile() • Mapping CtrlIDs • OOP in AutoIt • ParseHeadersToSciTE() • PasswordValid • PasteBin • Posts Per Day • PreExpand • Protect Globals • Queue() • Resource Update • ResourcesEx • SciTE Jump • Settings INI • SHELLHOOK • Shunting-Yard • Signature Creator • Stack() • Stopwatch() • StringAddLF()/StringStripLF() • StringEOLToCRLF() • VSCROLL • WM_COPYDATA • More Examples... Updated: 22/04/2018 Link to comment Share on other sites More sharing options...
guinness Posted October 12, 2012 Share Posted October 12, 2012 (edited) Please you [autoit][/autoit] tags when posting code. Have you thought that maybe the file is in use? See above code to rename at boot. Edited October 12, 2012 by guinness UDF List: _AdapterConnections() • _AlwaysRun() • _AppMon() • _AppMonEx() • _ArrayFilter/_ArrayReduce • _BinaryBin() • _CheckMsgBox() • _CmdLineRaw() • _ContextMenu() • _ConvertLHWebColor()/_ConvertSHWebColor() • _DesktopDimensions() • _DisplayPassword() • _DotNet_Load()/_DotNet_Unload() • _Fibonacci() • _FileCompare() • _FileCompareContents() • _FileNameByHandle() • _FilePrefix/SRE() • _FindInFile() • _GetBackgroundColor()/_SetBackgroundColor() • _GetConrolID() • _GetCtrlClass() • _GetDirectoryFormat() • _GetDriveMediaType() • _GetFilename()/_GetFilenameExt() • _GetHardwareID() • _GetIP() • _GetIP_Country() • _GetOSLanguage() • _GetSavedSource() • _GetStringSize() • _GetSystemPaths() • _GetURLImage() • _GIFImage() • _GoogleWeather() • _GUICtrlCreateGroup() • _GUICtrlListBox_CreateArray() • _GUICtrlListView_CreateArray() • _GUICtrlListView_SaveCSV() • _GUICtrlListView_SaveHTML() • _GUICtrlListView_SaveTxt() • _GUICtrlListView_SaveXML() • _GUICtrlMenu_Recent() • _GUICtrlMenu_SetItemImage() • _GUICtrlTreeView_CreateArray() • _GUIDisable() • _GUIImageList_SetIconFromHandle() • _GUIRegisterMsg() • _GUISetIcon() • _Icon_Clear()/_Icon_Set() • _IdleTime() • _InetGet() • _InetGetGUI() • _InetGetProgress() • _IPDetails() • _IsFileOlder() • _IsGUID() • _IsHex() • _IsPalindrome() • _IsRegKey() • _IsStringRegExp() • _IsSystemDrive() • _IsUPX() • _IsValidType() • _IsWebColor() • _Language() • _Log() • _MicrosoftInternetConnectivity() • _MSDNDataType() • _PathFull/GetRelative/Split() • _PathSplitEx() • _PrintFromArray() • _ProgressSetMarquee() • _ReDim() • _RockPaperScissors()/_RockPaperScissorsLizardSpock() • _ScrollingCredits • _SelfDelete() • _SelfRename() • _SelfUpdate() • _SendTo() • _ShellAll() • _ShellFile() • _ShellFolder() • _SingletonHWID() • _SingletonPID() • _Startup() • _StringCompact() • _StringIsValid() • _StringRegExpMetaCharacters() • _StringReplaceWholeWord() • _StringStripChars() • _Temperature() • _TrialPeriod() • _UKToUSDate()/_USToUKDate() • _WinAPI_Create_CTL_CODE() • _WinAPI_CreateGUID() • _WMIDateStringToDate()/_DateToWMIDateString() • Au3 script parsing • AutoIt Search • AutoIt3 Portable • AutoIt3WrapperToPragma • AutoItWinGetTitle()/AutoItWinSetTitle() • Coding • DirToHTML5 • FileInstallr • FileReadLastChars() • GeoIP database • GUI - Only Close Button • GUI Examples • GUICtrlDeleteImage() • GUICtrlGetBkColor() • GUICtrlGetStyle() • GUIEvents • GUIGetBkColor() • Int_Parse() & Int_TryParse() • IsISBN() • LockFile() • Mapping CtrlIDs • OOP in AutoIt • ParseHeadersToSciTE() • PasswordValid • PasteBin • Posts Per Day • PreExpand • Protect Globals • Queue() • Resource Update • ResourcesEx • SciTE Jump • Settings INI • SHELLHOOK • Shunting-Yard • Signature Creator • Stack() • Stopwatch() • StringAddLF()/StringStripLF() • StringEOLToCRLF() • VSCROLL • WM_COPYDATA • More Examples... Updated: 22/04/2018 Link to comment Share on other sites More sharing options...
Helen Posted October 12, 2012 Author Share Posted October 12, 2012 No Probs, will use the autoit tags in future. Will give that a go now and let you know. Thanks for the help Link to comment Share on other sites More sharing options...
guinness Posted October 12, 2012 Share Posted October 12, 2012 (edited) Whoops, spelling mistakes galore in that last post. Sorry Helen. Let me know how it goes.? Also I take no responsibility if something doesn't work or your system breaks. Edited October 12, 2012 by guinness UDF List: _AdapterConnections() • _AlwaysRun() • _AppMon() • _AppMonEx() • _ArrayFilter/_ArrayReduce • _BinaryBin() • _CheckMsgBox() • _CmdLineRaw() • _ContextMenu() • _ConvertLHWebColor()/_ConvertSHWebColor() • _DesktopDimensions() • _DisplayPassword() • _DotNet_Load()/_DotNet_Unload() • _Fibonacci() • _FileCompare() • _FileCompareContents() • _FileNameByHandle() • _FilePrefix/SRE() • _FindInFile() • _GetBackgroundColor()/_SetBackgroundColor() • _GetConrolID() • _GetCtrlClass() • _GetDirectoryFormat() • _GetDriveMediaType() • _GetFilename()/_GetFilenameExt() • _GetHardwareID() • _GetIP() • _GetIP_Country() • _GetOSLanguage() • _GetSavedSource() • _GetStringSize() • _GetSystemPaths() • _GetURLImage() • _GIFImage() • _GoogleWeather() • _GUICtrlCreateGroup() • _GUICtrlListBox_CreateArray() • _GUICtrlListView_CreateArray() • _GUICtrlListView_SaveCSV() • _GUICtrlListView_SaveHTML() • _GUICtrlListView_SaveTxt() • _GUICtrlListView_SaveXML() • _GUICtrlMenu_Recent() • _GUICtrlMenu_SetItemImage() • _GUICtrlTreeView_CreateArray() • _GUIDisable() • _GUIImageList_SetIconFromHandle() • _GUIRegisterMsg() • _GUISetIcon() • _Icon_Clear()/_Icon_Set() • _IdleTime() • _InetGet() • _InetGetGUI() • _InetGetProgress() • _IPDetails() • _IsFileOlder() • _IsGUID() • _IsHex() • _IsPalindrome() • _IsRegKey() • _IsStringRegExp() • _IsSystemDrive() • _IsUPX() • _IsValidType() • _IsWebColor() • _Language() • _Log() • _MicrosoftInternetConnectivity() • _MSDNDataType() • _PathFull/GetRelative/Split() • _PathSplitEx() • _PrintFromArray() • _ProgressSetMarquee() • _ReDim() • _RockPaperScissors()/_RockPaperScissorsLizardSpock() • _ScrollingCredits • _SelfDelete() • _SelfRename() • _SelfUpdate() • _SendTo() • _ShellAll() • _ShellFile() • _ShellFolder() • _SingletonHWID() • _SingletonPID() • _Startup() • _StringCompact() • _StringIsValid() • _StringRegExpMetaCharacters() • _StringReplaceWholeWord() • _StringStripChars() • _Temperature() • _TrialPeriod() • _UKToUSDate()/_USToUKDate() • _WinAPI_Create_CTL_CODE() • _WinAPI_CreateGUID() • _WMIDateStringToDate()/_DateToWMIDateString() • Au3 script parsing • AutoIt Search • AutoIt3 Portable • AutoIt3WrapperToPragma • AutoItWinGetTitle()/AutoItWinSetTitle() • Coding • DirToHTML5 • FileInstallr • FileReadLastChars() • GeoIP database • GUI - Only Close Button • GUI Examples • GUICtrlDeleteImage() • GUICtrlGetBkColor() • GUICtrlGetStyle() • GUIEvents • GUIGetBkColor() • Int_Parse() & Int_TryParse() • IsISBN() • LockFile() • Mapping CtrlIDs • OOP in AutoIt • ParseHeadersToSciTE() • PasswordValid • PasteBin • Posts Per Day • PreExpand • Protect Globals • Queue() • Resource Update • ResourcesEx • SciTE Jump • Settings INI • SHELLHOOK • Shunting-Yard • Signature Creator • Stack() • Stopwatch() • StringAddLF()/StringStripLF() • StringEOLToCRLF() • VSCROLL • WM_COPYDATA • More Examples... Updated: 22/04/2018 Link to comment Share on other sites More sharing options...
UEZ Posted October 12, 2012 Share Posted October 12, 2012 Are you running x64 OS? If yes, then compile your script as x64 adding this line and try again: #AutoIt3Wrapper_UseX64=y You need the full SciTE package installed! Br, UEZ Please don't send me any personal message and ask for support! I will not reply! Selection of finest graphical examples at Codepen.io The own fart smells best! ✌Her 'sikim hıyar' diyene bir avuç tuz alıp koşma!¯\_(ツ)_/¯ ٩(●̮̮̃•̃)۶ ٩(-̮̮̃-̃)۶ૐ Link to comment Share on other sites More sharing options...
guinness Posted October 12, 2012 Share Posted October 12, 2012 I updated the function in my previous post. UDF List: _AdapterConnections() • _AlwaysRun() • _AppMon() • _AppMonEx() • _ArrayFilter/_ArrayReduce • _BinaryBin() • _CheckMsgBox() • _CmdLineRaw() • _ContextMenu() • _ConvertLHWebColor()/_ConvertSHWebColor() • _DesktopDimensions() • _DisplayPassword() • _DotNet_Load()/_DotNet_Unload() • _Fibonacci() • _FileCompare() • _FileCompareContents() • _FileNameByHandle() • _FilePrefix/SRE() • _FindInFile() • _GetBackgroundColor()/_SetBackgroundColor() • _GetConrolID() • _GetCtrlClass() • _GetDirectoryFormat() • _GetDriveMediaType() • _GetFilename()/_GetFilenameExt() • _GetHardwareID() • _GetIP() • _GetIP_Country() • _GetOSLanguage() • _GetSavedSource() • _GetStringSize() • _GetSystemPaths() • _GetURLImage() • _GIFImage() • _GoogleWeather() • _GUICtrlCreateGroup() • _GUICtrlListBox_CreateArray() • _GUICtrlListView_CreateArray() • _GUICtrlListView_SaveCSV() • _GUICtrlListView_SaveHTML() • _GUICtrlListView_SaveTxt() • _GUICtrlListView_SaveXML() • _GUICtrlMenu_Recent() • _GUICtrlMenu_SetItemImage() • _GUICtrlTreeView_CreateArray() • _GUIDisable() • _GUIImageList_SetIconFromHandle() • _GUIRegisterMsg() • _GUISetIcon() • _Icon_Clear()/_Icon_Set() • _IdleTime() • _InetGet() • _InetGetGUI() • _InetGetProgress() • _IPDetails() • _IsFileOlder() • _IsGUID() • _IsHex() • _IsPalindrome() • _IsRegKey() • _IsStringRegExp() • _IsSystemDrive() • _IsUPX() • _IsValidType() • _IsWebColor() • _Language() • _Log() • _MicrosoftInternetConnectivity() • _MSDNDataType() • _PathFull/GetRelative/Split() • _PathSplitEx() • _PrintFromArray() • _ProgressSetMarquee() • _ReDim() • _RockPaperScissors()/_RockPaperScissorsLizardSpock() • _ScrollingCredits • _SelfDelete() • _SelfRename() • _SelfUpdate() • _SendTo() • _ShellAll() • _ShellFile() • _ShellFolder() • _SingletonHWID() • _SingletonPID() • _Startup() • _StringCompact() • _StringIsValid() • _StringRegExpMetaCharacters() • _StringReplaceWholeWord() • _StringStripChars() • _Temperature() • _TrialPeriod() • _UKToUSDate()/_USToUKDate() • _WinAPI_Create_CTL_CODE() • _WinAPI_CreateGUID() • _WMIDateStringToDate()/_DateToWMIDateString() • Au3 script parsing • AutoIt Search • AutoIt3 Portable • AutoIt3WrapperToPragma • AutoItWinGetTitle()/AutoItWinSetTitle() • Coding • DirToHTML5 • FileInstallr • FileReadLastChars() • GeoIP database • GUI - Only Close Button • GUI Examples • GUICtrlDeleteImage() • GUICtrlGetBkColor() • GUICtrlGetStyle() • GUIEvents • GUIGetBkColor() • Int_Parse() & Int_TryParse() • IsISBN() • LockFile() • Mapping CtrlIDs • OOP in AutoIt • ParseHeadersToSciTE() • PasswordValid • PasteBin • Posts Per Day • PreExpand • Protect Globals • Queue() • Resource Update • ResourcesEx • SciTE Jump • Settings INI • SHELLHOOK • Shunting-Yard • Signature Creator • Stack() • Stopwatch() • StringAddLF()/StringStripLF() • StringEOLToCRLF() • VSCROLL • WM_COPYDATA • More Examples... Updated: 22/04/2018 Link to comment Share on other sites More sharing options...
Helen Posted October 12, 2012 Author Share Posted October 12, 2012 (edited) It didn't work Below is the whole code: expandcollapse popup#RequireAdmin #include <Excel.au3> ; Keep these, not enough room to explain but keep it. #include <File.au3> ; Keep these, not enough room to explain but keep it. #include <APIConstants.au3> ; Included with WinAPIEx.au3 #include <WinAPIEx.au3> ; Download From [url="http://www.autoitscript.com/forum/topic/98712-winapiex-udf/"]http://www.autoitscript.com/forum/topic/98712-winapiex-udf/[/url] by Yashied. ConsoleWrite(_FileMoveEx('C:Example.dat', 'C:Example_Ex.dat') & @CRLF) Func _FileMoveEx($sSourcePath, $sDestinationPath, $iFlag = 0) Local $iReturn = FileMove($sSourcePath, $sDestinationPath, $iFlag) If $iReturn Then Return $iReturn EndIf Local $sDestinationFolder = _WinAPI_PathRemoveFileSpec($sDestinationPath) If BitAND($iFlag, 8) And FileExists($sDestinationFolder) = 0 Then DirCreate($sDestinationFolder) If BitAND($iFlag, 1) Then $iFlag = $MOVEFILE_REPLACE_EXISTING Else $iFlag = 0 Endif Return _WinAPI_MoveFileEx(FileGetShortName($sSourcePath), FileGetShortName($sDestinationPath), Bitor($iFlag, $MOVE_FILE_DELAY_UNTIL_REBOOT)) EndFunc ;==>_FileMoveEx Global $SLogPath = ("C:SwInstInstLog.txt") ; This is the location of the logfile. It also adds the time and date with the _Filewritelog command. Keep as a global varible. Global $sName Global $sFilePath Global $sCommandline Global $fAllusers Global $iRunOnce Global $sSourcePath Global $sDestinationPath Global $sSourcePatha Global $sDestinationPatha Global $iFlag Dim $CN ; Future Varible for Computer Name $sFile = "system32eps.sys" $sFile1 = "System32driverseps.sys" $sDestinationPath = "C:\Windows\System32\driverseps_old.sys" $sDestinationPatha = "C:\Windows\System32\eps_old.sys" $sSourcePath = "C:\Windows\System32\driverseps.sys" $sSourcePatha = "C:\Windows\System32\eps.sys" DirCreate("C:SwInst") ; This Creates the Directory needed for the packaged items (McAfee, Lumensionx86 + x64, Certero, Trend and the EPSConfig.xml for Lumension - You get the picture. ;Global $oExcel = _ExcelBookOpen("C:Support.xlsx") ;This is for the spreadsheet functionality more on this later. ;_ExcelSheetActivate($oExcel, "C:Support.xlsx") ; Spreadsheet functionality. FileInstall("C:SwInstFramePkg.exe", "C:SwInstFramePkg.exe") ;Fileinstall allows for the creation of the 'Field-Kit' it basically packages all the neccessary files into a nice little executable. FileInstall("C:SwInstCASSetup.exe", "C:SwInstCASSetup.exe") FileInstall("C:SwInstLMAgent32x.msi", "C:SwInstLMAgent32x.msi") FileInstall("C:SwInstLMAgentx64.msi", "C:SwInstLMAgentx64.msi") FileInstall("C:SwInstTrend.bat", "C:SwInstTrend.bat") FileInstall("C:SwInstEPSConfig.xml", "C:SwInstEPSConfig.xml") ;If $sReadCell = "Yes" then Filecopy ("GMS425448C$ProgramDataLumensionLMAgentDatapersistEPSConfig.xml", $CN " ; Excel functionality keep for now, as will add later for redundancy. ; Below is the runlist, it runs from top to bottom. Certero1() McAfee1() Lumenchecka() Lumension() TrendChk() End() Func Certero1() If @OSArch = 'X64' Then Certerox64() Else Certerox86() EndIf EndFunc ;==>Certero1 Func Certerox64() If FileExists("C:Program Files (x86)CerteroAssetStudioInventory Clientcasalert.exe") Then $sLogMsg = "Certero Already Installed" _FileWriteLog($SLogPath, $sLogMsg, -1) Else Certero() EndIf EndFunc ;==>Certerox64 Func Certerox86() If FileExists("C:Program FilesCerteroAssetStudioInventory Clientcasalert.exe") Then $sLogMsg = "Certero Already Installed" _FileWriteLog($SLogPath, $sLogMsg, -1) Else Certero() EndIf EndFunc ;==>Certerox86 Func Certero() Run("C:SwInstCASSetup.exe /SILENT", "C:Program Files") Sleep(750) WinActivate("AssetStudio Client Setup") Sleep(150) Send("{Enter}") Sleep(250) Send("{Enter}") Sleep(250) Send("GMSWEB11") Sleep(250) Send("{Enter}") Sleep(550) Send("{Enter}") Sleep(750) Send("{Enter}") Sleep(1500) WinActivate("AssetStudio Client Setup", "Completing the AssetStudio Client Setup Wizard") Send("{Enter}") Sleep(150) $sLogMsg = "Certero Installed" _FileWriteLog($SLogPath, $sLogMsg, -1) EndFunc ;==>Certero Func Mcafee1() If ProcessExists("FrameworkService.exe") Then $sLogMsg = "McAfee Already Installed and running." _FileWriteLog($SLogPath, $sLogMsg, -1) Else RunWait("C:SwInstframepkg.exe /FORCEINSTALL /INSTALL=AGENT /INSTDIR=C:PROGRAM FILESMcAfeeCommon Framework /SILENT", "C:Program Files") $sLogMsg = "McAfee Installed" _FileWriteLog($SLogPath, $sLogMsg, -1) EndIf EndFunc ;==>Mcafee1 Func Lumension() If @OSArch = 'X64' Then Lumension64() Else Lumension32() EndIf EndFunc ;==>Lumension Func Lumension32() If FileExists("C:Program FilesLumensionLEMSSAgentEPUIEPUI.exe") Then $sLogMsg = "LEMSS Agent Already Installed." _FileWriteLog($SLogPath, $sLogMsg, -1) Lumensiona32() Else Lumension321() EndIf EndFunc ;==>Lumension32 Func Lumension321() ShellExecute("C:SwInstLMAgent32x.msi") Sleep(5000) If WinExists("Lumension EMSS Agent Installer Information") Then WinActivate("Lumension EMSS Agent Installer Information") Send("{Enter}") Sleep(550) Send("{Enter}") Sleep(550) Lumeneps() ElseIf WinExists("Lumension EMSS Agent - Installation Wizard") Then WinActivate("Lumension EMSS Agent - Installation Wizard") Sleep(250) Send("{Enter}") Sleep(250) Send("{UP}") Sleep(250) Send("{Enter}") Sleep(250) Send("{Enter}") Sleep(250) Send("GMSLUMEN01") Sleep(250) Send("{Enter}") Sleep(250) Send("{Enter}") WinWait("Lumension EMSS Agent - Installation Wizard", "Installation Complete") WinActivate("Lumension EMSS Agent - Installation Wizard", "Installation Complete") Send("{Enter}") $sLogMsg = "Lumension Installed Today" _FileWriteLog($SLogPath, $sLogMsg, -1) EndIf EndFunc ;==>Lumension321 Func Lumension64() If FileExists("C:Program Files (x86)LumensionLEMSSAgentEPUIEPUI.exe") Then $sLogMsg = "LEMSS Agent Already Installed." _FileWriteLog($SLogPath, $sLogMsg, -1) Lumensiona64() Else Lumension641() EndIf EndFunc ;==>Lumension64 Func Lumension641() ShellExecute("C:SwInstLMAgentx64.msi") Sleep(5500) If WinExists("Lumension EMSS Agent Installer Information") Then WinActivate("Lumension EMSS Agent Installer Information") Send("{Enter}") Sleep(550) Send("{Enter}") Lumeneps() ElseIf WinExists("Lumension EMSS Agent - Installation Wizard") Then WinActivate("Lumension EMSS Agent - Installation Wizard") Sleep(250) Send("{Enter}") Sleep(250) Send("{UP}") Sleep(250) Send("{Enter}") Sleep(250) Send("{Enter}") Sleep(250) Send("GMSLUMEN01") Sleep(250) Send("{Enter}") Sleep(250) Send("{Enter}") WinWait("Lumension EMSS Agent - Installation Wizard", "Installation Complete") WinActivate("Lumension EMSS Agent - Installation Wizard", "Installation Complete") Send("{Enter}") $sLogMsg = "Lumension Installed Today" _FileWriteLog($SLogPath, $sLogMsg, -1) EndIf EndFunc ;==>Lumension641 Func Lumensiona32() FileCopy("C:SwInstEPSConfig.xml", "C:documents and settingsall usersappdataLumensionDataPersistEPSConfig.xml") $sLogMsg = "LEMSS EPSConfig x86 copied." _FileWriteLog($SLogPath, $sLogMsg, -1) EndFunc ;==>Lumensiona32 Func Lumensiona64() FileCopy("C:SwInstEPSConfig.xml", "C:ProgramdataLumensionDataPersistEPSConfig.xml") $sLogMsg = "LEMSS EPSConfig x64 copied." _FileWriteLog($SLogPath, $sLogMsg, -1) EndFunc ;==>Lumensiona64 Func TrendChk() If @OSArch = 'X64' Then ; This little function quickly checks the OS for version compliance. Uses a basic IF-NOT statment. Trendx64() ;Call inline with a IF-NOT statement. Else Trendx86() EndIf EndFunc ;==>TrendChk Func Trendx86() If ProcessExists("avp.exe") Then ;This checks if Kaspersky is installed, if it isn't it installs Trend - UGH! $sLogMsg = "Kaspersky installed, I will not install Trend" _FileWriteLog($SLogPath, $sLogMsg, -1) End() ElseIf ProcessExists("tmlisten.exe") Then $sLogMsg = "Trend already installed." _FileWriteLog($SLogPath, $sLogMsg, -1) End() Else RunWait("C:SwInstTrend.bat", "C:Program Files") $sLogMsg = "Trend Installed" _FileWriteLog($SLogPath, $sLogMsg, -1) EndIf EndFunc ;==>Trendx86 Func Trendx64() If ProcessExists("avp.exe") Then $sLogMsg = "Kaspersky installed, I will not install Trend" _FileWriteLog($SLogPath, $sLogMsg, -1) End() ElseIf ProcessExists("tmlisten.exe") Then $sLogMsg = "Trend already installed." _FileWriteLog($SLogPath, $sLogMsg, -1) End() Else RunWait("C:SwInstTrend.bat", "C:Program Files") $sLogMsg = "Trend Installed" _FileWriteLog($SLogPath, $sLogMsg, -1) EndIf EndFunc ;==>Trendx64 Func End() Exit ;This is the best command, it means your finished or nearly finished :) EndFunc ;==>End Func Lumeneps() _FileMoveEx($sSourcePath, $sDestinationPath, $iFlag = 0) Sleep(500) _FileMoveEx($sSourcePatha, $sDestinationPatha, $iFlag = 0) Sleep(500) FileCopy("C:SwinstSwinst.exe", "C:ProgramDataMicrosoftWindowsStart MenuProgramsStartupSwinst.exe") FileCopy("C:SwinstSwinst.exe", "C:Documents and SettingsAll usersStart MenuProgramsStartupSwinst.exe") MsgBox(1, "Wait", "Waiting for checks") RegWrite("HKEY_LOCAL_MACHINESOFTWARESwinton", "Lumen", "Reg_DWORD", "1") Shutdown(6) ;Force a reboot EndFunc ;==>Lumeneps Func Lumenchecka() $Lumenchecka = RegRead("HKEY_LOCAL_MACHINESOFTWARESwinton", "LumensionEps") If $Lumenchecka = 1 Then DirRemove("C:Program filesLumension", 1) DirRemove("C:Program Files (x86)Lumension", 1) Lumension() Else Lumension() EndIf EndFunc ;==>Lumenchecka Edited October 12, 2012 by Helen Link to comment Share on other sites More sharing options...
Helen Posted October 12, 2012 Author Share Posted October 12, 2012 I popped the msgbox in so it didnt keep rebooting my machine, but even after a reboot, the file is still there Link to comment Share on other sites More sharing options...
Helen Posted October 12, 2012 Author Share Posted October 12, 2012 SUCCESS!!! Apologies, I refreshed the window and all now changed. Thank you all for your help. Guiness your a star! Link to comment Share on other sites More sharing options...
guinness Posted October 12, 2012 Share Posted October 12, 2012 You're welcome. Though it would be great to be a start alas I'm not!! UDF List: _AdapterConnections() • _AlwaysRun() • _AppMon() • _AppMonEx() • _ArrayFilter/_ArrayReduce • _BinaryBin() • _CheckMsgBox() • _CmdLineRaw() • _ContextMenu() • _ConvertLHWebColor()/_ConvertSHWebColor() • _DesktopDimensions() • _DisplayPassword() • _DotNet_Load()/_DotNet_Unload() • _Fibonacci() • _FileCompare() • _FileCompareContents() • _FileNameByHandle() • _FilePrefix/SRE() • _FindInFile() • _GetBackgroundColor()/_SetBackgroundColor() • _GetConrolID() • _GetCtrlClass() • _GetDirectoryFormat() • _GetDriveMediaType() • _GetFilename()/_GetFilenameExt() • _GetHardwareID() • _GetIP() • _GetIP_Country() • _GetOSLanguage() • _GetSavedSource() • _GetStringSize() • _GetSystemPaths() • _GetURLImage() • _GIFImage() • _GoogleWeather() • _GUICtrlCreateGroup() • _GUICtrlListBox_CreateArray() • _GUICtrlListView_CreateArray() • _GUICtrlListView_SaveCSV() • _GUICtrlListView_SaveHTML() • _GUICtrlListView_SaveTxt() • _GUICtrlListView_SaveXML() • _GUICtrlMenu_Recent() • _GUICtrlMenu_SetItemImage() • _GUICtrlTreeView_CreateArray() • _GUIDisable() • _GUIImageList_SetIconFromHandle() • _GUIRegisterMsg() • _GUISetIcon() • _Icon_Clear()/_Icon_Set() • _IdleTime() • _InetGet() • _InetGetGUI() • _InetGetProgress() • _IPDetails() • _IsFileOlder() • _IsGUID() • _IsHex() • _IsPalindrome() • _IsRegKey() • _IsStringRegExp() • _IsSystemDrive() • _IsUPX() • _IsValidType() • _IsWebColor() • _Language() • _Log() • _MicrosoftInternetConnectivity() • _MSDNDataType() • _PathFull/GetRelative/Split() • _PathSplitEx() • _PrintFromArray() • _ProgressSetMarquee() • _ReDim() • _RockPaperScissors()/_RockPaperScissorsLizardSpock() • _ScrollingCredits • _SelfDelete() • _SelfRename() • _SelfUpdate() • _SendTo() • _ShellAll() • _ShellFile() • _ShellFolder() • _SingletonHWID() • _SingletonPID() • _Startup() • _StringCompact() • _StringIsValid() • _StringRegExpMetaCharacters() • _StringReplaceWholeWord() • _StringStripChars() • _Temperature() • _TrialPeriod() • _UKToUSDate()/_USToUKDate() • _WinAPI_Create_CTL_CODE() • _WinAPI_CreateGUID() • _WMIDateStringToDate()/_DateToWMIDateString() • Au3 script parsing • AutoIt Search • AutoIt3 Portable • AutoIt3WrapperToPragma • AutoItWinGetTitle()/AutoItWinSetTitle() • Coding • DirToHTML5 • FileInstallr • FileReadLastChars() • GeoIP database • GUI - Only Close Button • GUI Examples • GUICtrlDeleteImage() • GUICtrlGetBkColor() • GUICtrlGetStyle() • GUIEvents • GUIGetBkColor() • Int_Parse() & Int_TryParse() • IsISBN() • LockFile() • Mapping CtrlIDs • OOP in AutoIt • ParseHeadersToSciTE() • PasswordValid • PasteBin • Posts Per Day • PreExpand • Protect Globals • Queue() • Resource Update • ResourcesEx • SciTE Jump • Settings INI • SHELLHOOK • Shunting-Yard • Signature Creator • Stack() • Stopwatch() • StringAddLF()/StringStripLF() • StringEOLToCRLF() • VSCROLL • WM_COPYDATA • More Examples... Updated: 22/04/2018 Link to comment Share on other sites More sharing options...
guinness Posted October 12, 2012 Share Posted October 12, 2012 Helen, You may want to remove the ConsoleWrite(_FileMoveEx('C:Example.dat', 'C:Example_Ex.dat') & @CRLF) from your first line and to call the function you use _FileMoveEx($sSourcePath, $sDestinationPath, 0). $iFlag = 0 makes the parameter optional so you don't have to call it if you don't want. It's something you should look at doing, 'creating functions'. I would recommend reading the help file about that. UDF List: _AdapterConnections() • _AlwaysRun() • _AppMon() • _AppMonEx() • _ArrayFilter/_ArrayReduce • _BinaryBin() • _CheckMsgBox() • _CmdLineRaw() • _ContextMenu() • _ConvertLHWebColor()/_ConvertSHWebColor() • _DesktopDimensions() • _DisplayPassword() • _DotNet_Load()/_DotNet_Unload() • _Fibonacci() • _FileCompare() • _FileCompareContents() • _FileNameByHandle() • _FilePrefix/SRE() • _FindInFile() • _GetBackgroundColor()/_SetBackgroundColor() • _GetConrolID() • _GetCtrlClass() • _GetDirectoryFormat() • _GetDriveMediaType() • _GetFilename()/_GetFilenameExt() • _GetHardwareID() • _GetIP() • _GetIP_Country() • _GetOSLanguage() • _GetSavedSource() • _GetStringSize() • _GetSystemPaths() • _GetURLImage() • _GIFImage() • _GoogleWeather() • _GUICtrlCreateGroup() • _GUICtrlListBox_CreateArray() • _GUICtrlListView_CreateArray() • _GUICtrlListView_SaveCSV() • _GUICtrlListView_SaveHTML() • _GUICtrlListView_SaveTxt() • _GUICtrlListView_SaveXML() • _GUICtrlMenu_Recent() • _GUICtrlMenu_SetItemImage() • _GUICtrlTreeView_CreateArray() • _GUIDisable() • _GUIImageList_SetIconFromHandle() • _GUIRegisterMsg() • _GUISetIcon() • _Icon_Clear()/_Icon_Set() • _IdleTime() • _InetGet() • _InetGetGUI() • _InetGetProgress() • _IPDetails() • _IsFileOlder() • _IsGUID() • _IsHex() • _IsPalindrome() • _IsRegKey() • _IsStringRegExp() • _IsSystemDrive() • _IsUPX() • _IsValidType() • _IsWebColor() • _Language() • _Log() • _MicrosoftInternetConnectivity() • _MSDNDataType() • _PathFull/GetRelative/Split() • _PathSplitEx() • _PrintFromArray() • _ProgressSetMarquee() • _ReDim() • _RockPaperScissors()/_RockPaperScissorsLizardSpock() • _ScrollingCredits • _SelfDelete() • _SelfRename() • _SelfUpdate() • _SendTo() • _ShellAll() • _ShellFile() • _ShellFolder() • _SingletonHWID() • _SingletonPID() • _Startup() • _StringCompact() • _StringIsValid() • _StringRegExpMetaCharacters() • _StringReplaceWholeWord() • _StringStripChars() • _Temperature() • _TrialPeriod() • _UKToUSDate()/_USToUKDate() • _WinAPI_Create_CTL_CODE() • _WinAPI_CreateGUID() • _WMIDateStringToDate()/_DateToWMIDateString() • Au3 script parsing • AutoIt Search • AutoIt3 Portable • AutoIt3WrapperToPragma • AutoItWinGetTitle()/AutoItWinSetTitle() • Coding • DirToHTML5 • FileInstallr • FileReadLastChars() • GeoIP database • GUI - Only Close Button • GUI Examples • GUICtrlDeleteImage() • GUICtrlGetBkColor() • GUICtrlGetStyle() • GUIEvents • GUIGetBkColor() • Int_Parse() & Int_TryParse() • IsISBN() • LockFile() • Mapping CtrlIDs • OOP in AutoIt • ParseHeadersToSciTE() • PasswordValid • PasteBin • Posts Per Day • PreExpand • Protect Globals • Queue() • Resource Update • ResourcesEx • SciTE Jump • Settings INI • SHELLHOOK • Shunting-Yard • Signature Creator • Stack() • Stopwatch() • StringAddLF()/StringStripLF() • StringEOLToCRLF() • VSCROLL • WM_COPYDATA • More Examples... Updated: 22/04/2018 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