none
Script not working as expected RRS feed

  • Question

  • Hello All,

    Can you please fix the complailation error on the below script.

    I have created the small script to delete WMI perameter(ScheduleID) from the remote machines.

    Const wbemFlagReturnImmediately = &h10
    Const wbemFlagForwardOnly = &h20
    Const ForReading = 1, ForWriting = 2, ForAppending = 8
    
    	Set ofs = CreateObject("Scripting.FileSystemObject")
    	Set oF = oFs.opentextFile("c:\temp\input.txt",forreading)
    	Set oFout = oFs.createtextFile("c:\temp\output.csv",forwriting)
    	oFout.writeline "Machine,ScheduleID"
    		Do While oF.AtEndOfStream <> True  
    		strComputer = ucase(trim(oF.readline))
    		Set objWMIService = GetObject("winmgmts:\\" & strComputer & "\root\CCM\Scheduler")
    		Set colItems = objWMIService.ExecQuery("select * from ccm_scheduler_history",,48)
    		If colItems.Count <> 0 Then
    		For Each val in colItems
    			If LCase(val.ScheduleID) like "%CAS02545%" Then
    			    val.Delete
    			End If	
    		Next	
    			oFout.writeline strComputer & "," & val.scheduleID
    		End if
    		Set objWMIService = nothing   
    	loop
    	of.close
    	oFout.close

    Please help to fix it.


    THANKS SURESH M

    • Moved by Bill_Stewart Thursday, March 14, 2019 11:29 PM This is not "fix/debug/rewrite my script for me" forum
    Wednesday, November 21, 2018 4:42 PM

All replies