problems with AD/SCCM/MDT web service

Sep 25, 2013 at 7:00 PM
We've just upgraded our environment to SCCM 2012 SP1 and I migrated the web service from our old SCCM server to the new one. Recreated OSD task sequences with steps to remove computers from the OSD collections, but am getting an error saying that the Resource ID of the computer is not known or could not be determined when trying to clear the PXE flag or remove from my OSD collection.

Is anyone using the web interface successfully with these functions?

Thanks,

Chris

2013-09-17 15:37:53.9415|INFO|MaikKoster.Deployment.WebService.SCCM|Reading configuration
2013-09-17 15:37:53.9415|INFO|MaikKoster.Deployment.WebService.SCCM|Requested to remove computer NAME (MAC: F0:1F:AF:08:CC:68, UUID:4C4C4544-0058-4E10-8042-B2C04F4A5831) from collection ABC000D6
2013-09-17 15:37:53.9585|INFO|MaikKoster.Deployment.WebService.SCCM|Extracted Site code ABC from ID ABC000D6
2013-09-17 15:37:53.9585|INFO|MaikKoster.Deployment.SCCM.Controller|Connecting to site ABC.
2013-09-17 15:37:54.0465|INFO|MaikKoster.Deployment.SCCM.Controller|Connected to site ABC.
2013-09-17 15:37:54.0465|INFO|MaikKoster.Deployment.SCCM.Controller|Checking Scope
2013-09-17 15:37:54.0465|INFO|MaikKoster.Deployment.SCCM.Controller|Current Scope is "\DEF.domain.ext\root\sms\site_ABC".
2013-09-17 15:37:54.0635|INFO|MaikKoster.Deployment.SCCM.Controller|Checking Scope
2013-09-17 15:37:54.0635|INFO|MaikKoster.Deployment.SCCM.Controller|Current Scope is "\DEF.domain.ext\root\sms\site_ABC".
2013-09-17 15:37:55.4617|INFO|MaikKoster.Deployment.SCCM.Controller|Resource ID of the computer is not known or could not be determined
2013-09-17 15:37:55.4617|INFO|MaikKoster.Deployment.SCCM.Controller|Unable to remove computer NAME (MAC: XX:YY:ZZ:AA:BB:CC, UUID: 4C4C4544-0058-4E10-8042-B2C04F4A5831) from collection ABC000D6.
2013-09-17 15:37:55.4617|INFO|MaikKoster.Deployment.WebService.SCCM|Could not remove computer from collection. Returning "False"
2013-09-17 15:37:56.1327|INFO|MaikKoster.Deployment.WebService.SCCM|Reading configuration
2013-09-17 15:37:56.1367|INFO|MaikKoster.Deployment.WebService.SCCM|Requested to clear last PXE Advertisement flag for computer (MAC: XX:YY:ZZ:AA:BB:CC, UUID: 4C4C4544-0058-4E10-8042-B2C04F4A5831) at SCCM site .
2013-09-17 15:37:56.1367|INFO|MaikKoster.Deployment.SCCM.Controller|Connecting to site ABC.
2013-09-17 15:37:56.1367|INFO|MaikKoster.Deployment.SCCM.Controller|Connected to site ABC.
2013-09-17 15:37:56.1367|INFO|MaikKoster.Deployment.SCCM.Controller|Checking Scope
2013-09-17 15:37:56.1367|INFO|MaikKoster.Deployment.SCCM.Controller|Current Scope is "\DEF.domain.ext\root\sms\site_ABC".
2013-09-17 15:37:56.2337|INFO|MaikKoster.Deployment.SCCM.Controller|Resource ID of the computer is not known or could not be determined
2013-09-17 15:37:56.2337|INFO|MaikKoster.Deployment.SCCM.Controller|No computer found. Unable to reset last PXE Advertisement flag.
2013-09-17 15:37:56.2337|INFO|MaikKoster.Deployment.WebService.SCCM|unable to clear last PXE Advertisement flag. Returning "False"
Sep 27, 2013 at 4:03 PM
I'm not using that specific method however I am running into a similar issue with the AddComputerToCollection method. Are you using RemoveComputerFromCollection or RemoveComputerFromCollectionByID? Using the ID one should work.
Oct 1, 2013 at 12:05 AM
The RemoveComputerFromCollectionByID function looks like it would be helpful, however I'm coming up short on figuring out how I get the Resource ID for the computer to remove it from the collection? I see a GetResourceID function, but since the error indicates the web service can't locate the ResourceID based on the MAC address, does this GetResourceID function even work? And because I haven't found anything about using the RemoveComputerFromCollectionByID function, how would I pass the value from getting the ResourceID to the function to remove from the collection?

Thanks....

dhedges01 wrote:
I'm not using that specific method however I am running into a similar issue with the AddComputerToCollection method. Are you using RemoveComputerFromCollection or RemoveComputerFromCollectionByID? Using the ID one should work.
Oct 1, 2013 at 1:31 AM
Try something like this:


$UUID = $(gwmi win32_ComputerSystemProduct).UUID

$ws = New-WebServiceProxy -Uri 'http://webservice/SCCM.aspx'

$ResourceID = $ws.GetResourceID('',$UUID,<SCCMSiteCode>) NOTE: I put '' in the place where MAC Address would normally go. This doesn't always work in CM12

Remove Computer From Colletion

$ws.RemoveComputerFromCollectionById($ResourceID,<CollectionID>,$env:COMPUTERNAME)


The last call should return True or False. I haven't checked these so there may be typos. Watch out for copying the quotes, they may not copy correctly.

Hope this helps.
Oct 1, 2013 at 9:58 PM
I feel dense for asking, but how do I use that code? I am using a MDT task sequence which was using
cscript.exe %ScriptRoot%\ZTI_ExecuteWebservice.wsf /wsSection:RemoveComputerFromCollection

Thanks!
Oct 2, 2013 at 5:38 PM
Heh, sorry. That's all PowerShell code that you could execute from a PowerShell script.