Bulk update commandlines in SCCM-programs
Just a small script to update the commandline of a large number of programs in SCCM.
This script will change from “/q” to “/qb!”…
Set oLocator = CreateObject("WbemScripting.SWbemLocator") Set oSccmWmi = oLocator.ConnectServer(".", "root\sms\site_C01", "", "") Set oPrograms = oSccmWmi.ExecQuery("select * from SMS_Program where CommandLine LIKE '%msiexec%/q %'") For Each oProgram In oPrograms WScript.Echo "Package: " & oProgram.PackageID & " (" & oProgram.ProgramName & ")" WScript.Echo "Orginal: " & oProgram.CommandLine sNewCmd = Replace(oProgram.CommandLine, "/q", "/qb!") WScript.Echo " New: " & sNewCmd Set oModProgram = oSccmWmi.Get("SMS_Program.PackageID='" & oProgram.PackageID & "'" & ",ProgramName='" & oProgram.ProgramName & "'") oModProgram.CommandLine = sNewCmd oModProgram.Put_ ' Comment out this line if you want to test Set oModProgram = Nothing Next