Remove Line from LANDesk Actions.ini File

email me

This will remove the line containing SDCLIENTRECONNECT from the LANDesk actions.ini file

Option Explicit 

Dim txtFile, oFSO, oFile, txtLine, modifiedFile, delLine

Const ForReading = 1
Const ForWriting = 2

txtFile = "C:\Program Files (x86)\LANDesk\Shared Files\cbaroot\actions.ini"
delLine = "SDCLIENTRECONNECT"

Set oFSO = CreateObject("Scripting.FileSystemObject")
Set oFile = oFSO.OpenTextFile(txtFile, ForReading)

Do Until oFile.AtEndOfStream
    txtLine = oFile.ReadLine
    If InStr(txtLine, delLine) = 0 Then
        modifiedFile = modifiedFile & txtLine & vbCrLf
    End If
Loop


oFile.Close

Set oFile = oFSO.OpenTextFile(txtFile, ForWriting)

oFile.Write modifiedFile
oFile.Close

'session clean up
txtFile = ""
delLine = ""
txtLine = ""
modifiedFile = ""
set oFSO = Nothing
set oFile = Nothing

WScript.Quit(0)

Also see Update Line from LANDesk Actions.ini File File

 
Notes

Client Issue

When a LANDesk package is pushed and there is a pending update, the SDCLIENTRECONNECT line is generated.

Once this line exists, no other packages can be pushed until one of two things happen:

#1 The machine is rebooted. Once rebooted, the SDCLIENTRECONNECT line is cleared and packages can be pushed.

#2 Add quotes around Program Files (x86), just like the other lines. When quotes are added, packages can be pushed.

 
Technical Problem

Missing quotes on the SDCLIENTRECONNECT line if forcing unnecessary reboots.

 
Solution

Add quotes to generated line.

Screenshot