I am using a PowerShell script in my OSD front end that does something similar.
Here are a few pieces to start with. Note this is with WinPE 4.0 w/PowerShell
3.0.
$typedname - Computername of the machine you want to delete
$siteserver - Your ConfigMgr site server
$sitecode - Your ConfigMgr site code
$sccmcred - Credentials to connect to your site server
$macaddress = (get-ciminstance win32_networkadapter -property
Name,MacAddress,AdapterType| where adaptertype -eq "Ethernet 802.3").MACAddress
$uuid = (Get-WmiObject uuid -Namespace root\cimv2 -class
win32_computersystemproduct).uuid
$computer = Get-WMIObject -ComputerName $siteserver -Namespace
"root\sms\site_$siteCode" -Query "select * from sms_r_system where name =
'$typedname' or macaddresses like '$macaddress' or smbiosguid = '$uuid'"
-Credential $sccmcred
foreach ($comp in $computer) {
$comp.psbase.Delete()
}
Daniel Ratliff
From: [email protected] [mailto:[email protected]] On
Behalf Of Kevin Johnston
Sent: Thursday, August 15, 2013 8:20 PM
To: '[email protected]'
Subject: RE: [mssms] SCCM 12 client on reused hardware
Thanks for the feedback.
I will look into a startup script. I was hoping there was a way to do it so the
helpdesk does not have to delete the object first.
A scripted way to delete the file in sccm might be a better approach.
I will test both out and see what happens.
Thanks,
From: [email protected]<mailto:[email protected]>
[mailto:[email protected]]<mailto:[mailto:[email protected]]>
On Behalf Of CESAR.ABREG0 .
Sent: Thursday, August 15, 2013 2:54 PM
To: [email protected]<mailto:[email protected]>
Subject: Re: [mssms] SCCM 12 client on reused hardware
+1 or startup script through GPO.
You can also delete the record from sccm (scripted) but historical data would
be deleted as well.
On Thu, Aug 15, 2013 at 11:45 AM, Ryan
<[email protected]<mailto:[email protected]>> wrote:
I'd suggest a logon script that searches for the client and then installs it if
it isn't there.
On Thu, Aug 15, 2013 at 1:39 PM, Kevin Johnston
<[email protected]<mailto:[email protected]>> wrote:
Like every other company, we tend to use a naming convention that includes an
asset tag. SCCM will install the client and all that jazz, but let's say that
person leaves the company after a month. So the help desk guys take the
machine, do their thing, then reimage it.
Our current imaging solution is not using SCCM and the client is not installed
on it.
So in SCCM it shows the machine name, and says it has a client but that it is
inactive. Makes sense since it no longer can find that machine with the agent.
So how do I get it to check if the agent is there, and if not to install it? It
does that for a brand new machine, but because the machine name is reused it
does nothing.
If I click on Deploy agent, then everything is fine.... But I would like to
make it a bit more automated as I have a bunch of inactive machines that I know
have been deployed.
*note, we are currently using MDT 2010 U1 for our image deployment, and will be
making the trip to SCCM12 in the next few months.*
Thanks,
Kevin Johnston
The information transmitted is intended only for the person or entity to which
it is addressed
and may contain CONFIDENTIAL material. If you receive this
material/information in error,
please contact the sender and delete or destroy the material/information.