sc openservice failed 5 access is denied Task Schedule Windows 2008 R2


  • Hello,

    I want to enable check box "Allow service to interact with desktop" for Task Scheduler service, but when make this steps:

    Start -> Run -> services.msc -> Task Scheduler -> Right Click -> Properties -> Log on tab all options are grey 

    All other tabs for that services are grey and I can not do anything. Also I can not start/stop Task Scheduler service. 

    I'm loged with system build in account I try to make above steps and with local administrator of the machine, but result is the same. Why?

    When try to run in cmd this commands:

    C:\Users\Administrator.NEXTPOINTHOST>sc sdshow Schedule
    [SC] OpenService FAILED 5:
    Access is denied.
    C:\Users\Administrator.NEXTPOINTHOST>sc stop Schedule
    [SC] OpenService FAILED 5:
    Access is denied.
     Where the problem how I can reconfigure Task Scheduler service?

    Sunday, June 5, 2011 7:58 PM

All replies

  • Ok in this way how to run this vbs script and it to running normal, because when I run via cmd the script do what I want, but when I run like schedule task job complete without any errors, but script do not do anything why?
    This is the script:
    ' преравя процесите в Windows, взима ползваната памет и притежателите им. спира процесите с голям разход на памет
    ' изисква администраторски права за четенето на притежателите и за спирането на процеси
    ' Mem Usage = Working Set (Memory)
    ' VM size = Commit Size
    Option Explicit
    Dim objWMIService, objProcess, colProcess			' to loop processes
    Dim strNameOfUser, Return					' to get owner of process
    Dim intUsedMemory, boolKill					' to calc total used memory by processes owner
    Dim strUserName, intQuotaTotalMemory, intQuotaAppMemory		' input parameters
    If WScript.Arguments.Count = 3 Then														' get parameteres from command line
    	strUserName = WScript.Arguments.Item(0)													' Get UserName	
    	If IsNumeric(WScript.Arguments.Item(1)) Then intQuotaTotalMemory = Int(WScript.Arguments.Item(1)) Else intQuotaTotalMemory = 0 End If 	' Get QuotaTotalMemory for the user
    	If intQuotaTotalMemory <= 0 Then
    		WScript.Echo "Invalid value for 'QuotaTotalMemory'"
    	End If
    	If IsNumeric(WScript.Arguments.Item(2)) Then intQuotaAppMemory = Int(WScript.Arguments.Item(2)) Else intQuotaAppMemory = 0 End If	' Get QuotaAppMemory
    	If intQuotaAppMemory <= 0 Then
    		WScript.Echo "Invalid value for 'QuotaAppMemory'"
    	End If
    	WScript.Echo "Usage: processes.vbs UserName QuotaTotalMemory[kb] QuotaAppMemory[kb]"
    End If
    intUsedMemory = 0
    boolKill = false
    'Dim objLoc
    'Set objLoc = createobject("wbemscripting.swbemlocator")
    'objLoc.Security_.privileges.addasstring "sedebugprivilege", true
    Set objWMIService = GetObject("winmgmts:{impersonationLevel=impersonate, (Debug)}!\\.\root\cimv2") 	' Computer = .
    Set colProcess = objWMIService.ExecQuery("Select * from Win32_Process")
    For Each objProcess in colProcess
    	Return = objProcess.GetOwner(strNameOfUser)
    'If Return = 0 Then msgbox strNameOfUser
    	If Return = 0 Then
    		If strNameOfUser = strUserName Then		
    			intUsedMemory = intUsedMemory + (objProcess.WorkingSetSize / 1024)
    			'MsgBox intUsedMemory
    			If intUsedMemory > intQuotaTotalMemory Then
    				boolKill = true
    				Exit For
    			End If
    		End If
    	End If
    Function KillByProcess(Name)
    	Dim objProc, colProc, strUsr
    	Set colProc = objWMIService.ExecQuery("Select * from Win32_Process where Name = '" & Name & "'")
    	For Each objProc in colProc
    		On Error Resume Next
    			' Get process owner
    			Return = objProc.GetOwner(strUsr)
    			' Terminate the process 
    			If Return = 0 And Err.Number = 0 And strUsr = strUserName Then objProc.Terminate()
    		On Error Goto 0
    	Set colProc = Nothing
    End Function
    If boolKill Then
    	For Each objProcess in colProcess
    		On Error Resume Next
    			Return = objProcess.GetOwner(strNameOfUser)
    			If Return = 0 And Err.Number = 0 Then
    				'If strNameOfUser = strUserName And (objProcess.WorkingSetSize / 1024) > intQuotaAppMemory Then MsgBox objProcess.WorkingSetSize & " " & objProcess.Name & " : " & objProcess.Terminate()
    				If (strNameOfUser = strUserName) And (objProcess.Name <> "explorer.exe") And (objProcess.WorkingSetSize / 1024) > intQuotaAppMemory Then 
    					call KillByProcess(objProcess.Name)
    				End If
    			End If
    		On Error Goto 0
    End If
    Tuesday, June 7, 2011 7:04 AM
  • Thank you I will ask scripting guys.
    Wednesday, June 8, 2011 7:18 AM