That’s what I thought at least. Consider this snippet of code from the Delete computers from SMS VBscript:
Set objResource = GetObject( "WinMgmts:\\" & strSMSServer & _
"\root\SMS\site_" & strSMSSiteCode & _
":SMS_R_System.ResourceID=" & cint(intResourceID))
This statement would fail about 50% of the time. The error code was
Google was not my friend. It was down to debugging the code line by line. Now I’d like to say I spotted it immediately, but it took me two hours of looking over the script to finally work out what was going on.
The number of computers in our SMS database exceeds 32768, which is the limit for an
integer variable. The
cint function was reporting an Overflow error as the value of
intResourceID was over 32768. Foiled by a bug in 4 year old code from Microsoft.
The answer was to change