sobert Posted June 3, 2015 Posted June 3, 2015 (edited) Hello,I have a script that is constantly getting stuck because a Windows service keeps starting and interrupting the script.I tried using RunWait(@ComSpec & " /c " & 'net stop CcmExec', "", @SW_HIDE) but then realized that the service has not started yet when I run that command.Is there a way to stop a service from running before it even starts?Note: Disabling the service all together is not an option because in the event this script gets hung or fails, that service will remain disabled.Thanks in advanced. Edited June 3, 2015 by sobert
spudw2k Posted June 3, 2015 Posted June 3, 2015 I am not aware of a way besides changing the startup. You could attempt to stop the service, set the service startup to manual, run your script and undo (change the startup back to automatic and star the service). Obviously this runs the same risk as your "Disabling" scenario (script failure and revert revert service).You could always query the service and wait until it is running, then stop it and continue your script.Hopefully there isn't another process that will launch the service, otherwise I think your only option is to disable the service. 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
Moderators JLogan3o13 Posted June 3, 2015 Moderators Posted June 3, 2015 What are you doing in your script that it is getting hung up by ccmexec? As this is the service for SCCM, unless you're the SCCM admin for your enterprise (in which case you would have the tools to delay startup of this service) I would be curious as to why you're trying to block it's launch? "Profanity is the last vestige of the feeble mind. For the man who cannot express himself forcibly through intellect must do so through shock and awe" - Spencer W. Kimball How to get your question answered on this forum!
spudw2k Posted June 4, 2015 Posted June 4, 2015 I ran into the same issue in my org. I didn't script nor go into why it was necessary, but apparently the CCM service interfered with user state migration automation script.Not especially helpful, and like I said, I don't know the technical reason or limitation involved. I am just empathizing. 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
Moderators JLogan3o13 Posted June 4, 2015 Moderators Posted June 4, 2015 It was truly a curiosity question; in all my years with SCCM and SMS before it, I never ran into an issue where I had to kill the service. Seems an odd situation; would likely be better to spend the time to find out why ccmexec is causing the problem, rather than killing the service (which can cause problems with the machine heartbeat, etc. etc.). @OP - If you really cannot do it any other way, I would rethink this:Note: Disabling the service all together is not an option because in the event this script gets hung or fails, that service will remain disabled.If you are using proper error checking, your concern for the script hanging or failing should be minimal. I would set the service startup type to disabled, do what you need to do in your script, then set it to enabled and then restart service. Again, not at all my first avenue of choice, but definitely the way I would approach it if I absolutely had no alternative. "Profanity is the last vestige of the feeble mind. For the man who cannot express himself forcibly through intellect must do so through shock and awe" - Spencer W. Kimball How to get your question answered on this forum!
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