0

GOAL: Rename all AD Objects to new convention and move them to new OU's in a restructured AD hierarchy.

I have a PS script that utilizes the SCCM site module and the Active Directory module to do the following:

  • Get-CMCollectionMember
  • For each Member name, Remove-CMDevice
  • Move-ADObject of the same Member name
  • Rename-Computer of the same Member name
  • Reboot the computer
  • Run SCCM TriggerSchedules for DDR and Hardware Inventory

When I run the triggerschedules, the PSComputerName shows as the computer objects OLD name. Not the new one.

Everything else seems to work - the AD object is moved, then renamed. The 'new' SCCM Device Object shows up in SCCM (via Delta System Discovery - Interval 5 min).

The problem is that SCCM (the client, I suspect) is holding on to old object info.

My question is, short of just reinstalling the client...why is this happening? I am not renaming the object in SCCM - the first step is actually removing the devices from SCCM. They are then rediscovered via Delta system discovery.

When I run...

Invoke-WMIMethod -ComputerName WD001-WK100 -Namespace root\ccm -Class SMS_CLIENT -Name TriggerSchedule $schedule

...at the end of the process, PSComputername is the old name.

Any advice appreciated.

2
  • Which schedule are you triggering? I assume machine policy (00000000-0000-0000-0000-000000000022)? According to my research you would need a heart beat for this to update which is scheduled only to happen every 7 days by default. So this would probably be the schedule for a DiscoveryDataRecord (00000000-0000-0000-0000-000000000003) Commented Nov 28, 2018 at 8:22
  • Hi Syberdoor. Heartbeat is running every 4 hours. I am running the DDR schedule manually at the end of the script. The issue is that the output from running the schedule shows the old computer name for PSComputername. So the old name is lurking around somewhere. I think it is something to do with the SCCM Client on the machine. Commented Nov 28, 2018 at 12:19

1 Answer 1

0

Reinstalling the SCCM Client is simple, and works. I am just running this on the end instead of running cycles, since they all run when the client is reinstalled, anyway. It also clears up my issue:

Install-CMClient -DeviceName $pc -AlwaysInstallClient $true -ForceReinstall $true

Thank you!

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.