ConfigMgr 2012 Inventory Max Random Delay

Have you ever noticed, and been confused by, why sometimes, for some new client installations of the ConfigMgr 12 client, it seems like Hardware Inventory, the very first one, takes forever to trigger naturally?  That's by design.

There's something called "Inventory Max Random Delay", which is a setting you can modify--just not via the console.  My understanding of what it is for is to randomize when, for example, someone uses client push to say... their entire, newly discovered, every single system discovered in AD.  It's so that there isn't a flood of full inventory within 10 minutes in those cases.  Of course, if you're a mature installation--it's unlikely that you'll have that.  By default it is 240 minutes (4 hours)--at my company we've changed ours to 60.  To see what it is set to, here's the SQL you'd run in SQL Server Management Studio against your cm_sitecode database, just to see what yours it set at: (view only, it changes nothing.)  Each primary will have it set. (If you are unlucky to have a CAS, it will have it as well; but a CAS has no clients so it's not really relevant; but for consistency may want to change it)

SELECT SD.SiteCode, SCC.ClientComponentName, SCP.Name, SCP.Value1, SCP.Value2, SCP.Value3 FROM SC_ClientComponent SCC JOIN SC_SiteDefinition SD ON SD.SiteNumber = SCC.SiteNumber JOIN SC_ClientComponent_Property SCP ON SCP.ClientComponentID = SCC.ID WHERE SCP.Name like '%Inventory Max Random Delay%'

  To adjust the Max Random Delay, you run the below as a vbscript, after modifying the SiteCode to match the one you are changing

You run it as cscript whatever.vbs YourPrimaryServerName The3CharSiteCode  (after changing the desiredvalue and sitecode inside).  For example, if my primary site server name was "CMPRIMARY" and it's site code was PR1, I'd confirm that the sitecode in the script said "PR1" (it does, how convenient for me!), and I'd run  cscript.exe whatever.vbs cmprimary pr1

If you have multiple primaries, you need to run it on each one--it's per sitecode.

'***********vbscript below******************
'NOTE! Be careful if in displaying this on a blog, the ' or " are converted to "smart quotes" !

On Error Resume Next

'*** Define string variables for device, device Resource ID and user of interest

Class_Name = "SMS_SCI_ClientComp"
Class_ItemName = "Hardware Inventory Agent" ' "Software Inventory Agent" for SINV
Class_ItemType = "Client Component"
Property_Name = "Hardware Inventory Max Random Delay Minutes" ' "Software Inventory Max Random Delay Minutes" for SINV
Property_SiteCode = "PR1" ' Replace Site Code for Primary Site here
DesiredValue = 60 ' Desired Value in Minutes

'*** Check parameters - we need the provider server name and the site code

set args=wscript.arguments

If args.Count = 2 then
SMSProviderServer = UCASE(Wscript.Arguments(0))
SiteCode = UCASE(Wscript.Arguments(1))
wscript.Echo "Incorrect command line arguments." & vbCrLf & "Usage: cscript /nologo ModifySCFProperty.vbs <smsproviderserver> <sitecode>" & vbCrLf & "Example: cscript /nologo ModifySCFProperty.vbs SERVER1 S01" & vbCrLf
End If

'*** Connect to the provider - report the error and terminate on failure

SMSProviderServer = "\\" + SMSProviderServer + "\"
Set ObjSvc = GetObject("winmgmts:" & "{impersonationLevel=Impersonate,authenticationLevel=Pkt}!" & SMSProviderServer & "root\sms\site_" & SiteCode)

If Err.Number <> 0 Then
wscript.Echo "Failed to connect to provider server with code: " & Err.Number & ". Aborting!"
End If

'*** Get the desired instance of the class

Set objInst = ObjSvc.Get(Class_Name & ".ItemName='" & Class_ItemName & "',ItemType='" & Class_ItemType & "',SiteCode='" & Property_SiteCode &"'")

If Err.Number <> 0 Then
WScript.Echo "Failed to open desired object with error code " & Err.Number & " (" & Err.Description & "). Aborting!"
End If

'*** Loop through the Properties until we find a match or run out

bFoundProperty = False

For Each objProp in objInst.Props
If objProp.PropertyName = Property_Name Then
bFoundProperty = True
Exit For
End If

If bFoundProperty = False Then
WScript.Echo "Desired object was found but property was not found. Exiting without making any changes."
End If

'*** Property found so check to see if existing value matches desired, changing it as appropriate

If objProp.Value = DesiredValue Then
WScript.Echo "Property '" & Property_Name & "' found with desired value '" & DesiredValue & "'. Not making any changes."
OriginalValue = objProp.Value
objProp.Value = DesiredValue

If Err.Number <> 0 Then
wscript.Echo "Failed to save the desired change with code: " & Err.Number & ". Aborting!"
WScript.Echo "Property '" & Property_Name & "' successfully changed from '" & OriginalValue & "' to '" & DesiredValue & "'."
End If
End If

  • Created on .
Copyright © 2020 - The Twin Cities Systems Management User Group