Skip to content
View in the app

A better way to browse. Learn more.

MSFN

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

runonce issues..

Featured Replies

I have been using the runonce keys in windows 7 for quite some time, but I finally hit something I can't figure out..

I am attempting to update an instance of Oracle DB and I am having an issue with how runonce is behaving.. I am using autoit to make the regkeys and they all seem to work normal, until the last step..

The code for each step is broken down into three steps.. 1. turn off / set services to demand (manual), 2. run the opatch command, 3. turn the services to automatic / on and run some sql files.

Here is the code for the run once..

If @OSVersion = "WIN_7" then $path = "D:\"If @OSVersion = "WIN_2008R2" then $path = "C:\"RegWrite("HKEY_LOCAL_MACHINE64\SOFTWARE\Microsoft\Windows\CurrentVersion\RunOnceEx", "Flags", "REG_DWORD", "20")RegWrite("HKEY_LOCAL_MACHINE64\SOFTWARE\Microsoft\Windows\CurrentVersion\RunOnceEx", "TITLE", "REG_SZ", "Running Oracle Update")RegWrite("HKEY_LOCAL_MACHINE64\SOFTWARE\Microsoft\Windows\CurrentVersion\RunOnceEx\0001", "", "REG_SZ", "Oracle Update Part 2")RegWrite("HKEY_LOCAL_MACHINE64\SOFTWARE\Microsoft\Windows\CurrentVersion\RunOnceEx\0001", "101", "REG_SZ", $path & @OSArch & "\OracleCPUSAMSEPart2.exe")RegWrite("HKEY_LOCAL_MACHINE64\SOFTWARE\Microsoft\Windows\CurrentVersion\RunOnceEx\0001", "102", "REG_SZ", "shutdown -t 0 -r -f")RegWrite("HKEY_LOCAL_MACHINE64\SOFTWARE\Microsoft\Windows\CurrentVersion\RunOnceEx\0002", "", "REG_SZ", "Oracle Update Part 3")RegWrite("HKEY_LOCAL_MACHINE64\SOFTWARE\Microsoft\Windows\CurrentVersion\RunOnceEx\0002", "101", "REG_SZ", $path & @OSArch & "\OracleCPUSAMSEPart3.exe")RegWrite("HKEY_LOCAL_MACHINE64\SOFTWARE\Microsoft\Windows\CurrentVersion\RunOnceEx\0002", "102", "REG_SZ", "shutdown -t 0 -r -f")RegWrite("HKEY_LOCAL_MACHINE64\SOFTWARE\Microsoft\Windows\CurrentVersion\RunOnceEx\0003", "", "REG_SZ", "Cleanup")RegWrite("HKEY_LOCAL_MACHINE64\SOFTWARE\Microsoft\Windows\CurrentVersion\RunOnceEx\0003", "101", "REG_SZ", "D:\cleanup.exe")

Since this is broken down into three steps here is the code for the steps, which is ran before the runonce keys are written

Step1.exe (works / runs before the runonce keys are written)

RunWait("sc config SAMSEFTP start= Demand","",@SW_HIDE)RunWait("sc config MSDTC start= Demand","",@SW_HIDE)RunWait("sc config OracleServiceSAMSE start= Demand","",@SW_HIDE)RunWait("sc config OracleOraDb11g_home1TNSListener start= Demand","",@SW_HIDE)RunWait('sc config "EFT Server" start= Demand',"",@SW_HIDE)RunWait("sc config MatSchedulerService start= Demand","",@SW_HIDE)RunWait("sc stop SAMSEFTP","",@SW_HIDE)RunWait("sc stop MSDTC","",@SW_HIDE)RunWait("sc stop OracleServiceSAMSE","",@SW_HIDE)RunWait("sc stop OracleOraDb11g_home1TNSListener","",@SW_HIDE)RunWait('sc stop "EFT Server"',"",@SW_HIDE)RunWait("sc stop MatSchedulerService","",@SW_HIDE)

Step2.exe (works)

If @OSVersion = "WIN_7" then $path = "D:\"If @OSVersion = "WIN_2008R2" then $path = "C:\"FileInstall(".\runOPatch.CMD", $path & @OSArch & "\files\runOPatch.CMD")FileInstall(".\regDll.CMD", $path & @OSArch & "\files\regDll.CMD")RunWait($path & @OSArch & "\files\runOPatch.CMD",$path & @OSArch)RunWait($path & @OSArch & "\files\regDll.CMD",$path & "app\sams.admin\product\11.2.0\dbhome_1\ODP.NET\bin\2.x")RunWait($path & @OSArch & "\files\regDll.CMD",$path & "app\sams.admin\product\11.2.0\dbhome_1\ODP.NET\bin\4")RunWait('sc config SAMSEFTP start= Auto',"",@SW_HIDE)RunWait('sc config MSDTC start= Demand',"",@SW_HIDE)RunWait('sc config OracleServiceSAMSE start= Auto',"",@SW_HIDE)RunWait('sc config OracleOraDb11g_home1TNSListener start= Auto',"",@SW_HIDE)RunWait('sc config "EFT Server" start= Auto',"",@SW_HIDE)RunWait('sc config MatSchedulerService start= Auto',"",@SW_HIDE)

Step3.exe (doesn't seem to run)

#include ".\Services.au3"Global $ServiceStatus,$service_ServiceStatus("SAMSEFTP")_ServiceStatus("OracleServiceSAMSE")_ServiceStatus("OracleOraDb11g_home1TNSListener")RunWait('net start "EFT Server"','',@sw_hide)_ServiceStatus("MatSchedulerService")If @OSVersion = "WIN_7" then $path = "D:\"If @OSVersion = "WIN_2008R2" then $path = "C:\"FileInstall(".\RunCpu.sql", $path & @OSArch & "\files\RunCpu.sql")FileInstall(".\runUtlrp.sql", $path & @OSArch & "\files\runUtlrp.sql")FileInstall(".\PatchCleanup.sql", $path & @OSArch & "\files\PatchCleanup.sql")RunWait("sqlplus /nolog @" & $path & @OSArch & "\files\RunCpu.sql",$path & "app\sams.admin\product\11.2.0\dbhome_1\Bundle\Patch28")RunWait("sqlplus /nolog @" & $path & @OSArch & "\files\runUtlrp.sql",$path & "app\sams.admin\product\11.2.0\dbhome_1\RDBMS\ADMIN")RunWait("sqlplus /nolog @" & $path & @OSArch & "\files\PatchCleanup.sql",$path & @OSArch & "\files")if FileExists($path & "app\sams.admin\product\11.2.0\dbhome_1\ccr\") Then DirRemove($path & "app\sams.admin\product\11.2.0\dbhome_1\ccr\",1)DirRemove($path & @OSArch &"\",1)func _ServiceStatus($service)RunWait("net start " & $service,'',@sw_hide)do$ServiceStatus = _Service_QueryStatus($service)sleep(5000)until $ServiceStatus[1] = "4"EndFunc

I think the problem lies with how runonce keys are called.. Meaning the runonce runs step2, then runs the reboot command, then imediately launches step3.exe (i see the bolded text move onto the next item), then the system reboots.. upon reboot step3.exe is still there, but it sits there for a few seconds then moves onto cleanup.. So either the runonce is calling it or there is an issue with my step3.exe

I can run each step manually and they run fine.. it is either the runonce or something else is nto running properaly.. I know there is something I am missing, but i cant figure it out.. and it is probably pretty easy.. Also the reboot in the runonce after step3 never happens.. This is another reason I think it is a runonce problem and not a autoit problem.

Thanks for the help..

Edited by mchipser

Create an account or sign in to comment

Recently Browsing 0

  • No registered users viewing this page.

Account

Navigation

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.