Link to home
Start Free TrialLog in
Avatar of Ackles
AcklesFlag for Switzerland

asked on

Powershell delete computer from SCCM

Hello,
I need help to user Powershell to delete a computer from SCCM by providing the name only.
However, before deleting it should capture the UUID & MAC ADDRESS for reference.

Any help is appreciated.
Regards,
A
Avatar of Leon Taljaard
Leon Taljaard
Flag of South Africa image

Hey,

Didn't see you logged it :) I added this code to the other one as well.

$DeviceDetails = Get-CMDevice -Name 'Device Name'
$DeviceDetails = $DeviceDetails | Select-Object -Property Name, MACAddresses, SMBIOSGUID
$DeviceDetails | Export-Csv -Path "c:\Temp\SCCMRemovedDevices.csv" -NoTypeInformation

Open in new window


I am adding the remove now
Here you go

$DeviceName = Read-Host -prompt "Please Enter Device Name"
$DeviceDetails = Get-CMDevice -Name $DeviceName
$DeviceDetails = $DeviceDetails | Select-Object -Property Name, MACAddresses, SMBIOSGUID
$DeviceDetails | Export-Csv -Path "c:\Temp\SCCMRemovedDevices.csv" -NoTypeInformation
Remove-CMDevice -Name $DeviceName -Force

Open in new window

ASKER CERTIFIED SOLUTION
Avatar of Leon Taljaard
Leon Taljaard
Flag of South Africa image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Hi,

Have you been able to test this?
Avatar of Ackles

ASKER

Hi There,
Sorry yesterday was crazy.... will let you know today.
Avatar of Ackles

ASKER

Excellent!
Thanks!
Perfect, glad it worked