Share via


How to clear prestaging property from computer objects in AD via Powershell

This how-to article shows how to use Powerhell to clear NetbootGUID property from computer objects in Active Directory, this is also the GUID value in Remote Install tab of the Computer Account to prestage machine. It could be added by you or Windows Deployment Services (WDS).

I'll try to show it step-by-step from listing to clearing and a bit filtering.

Note : (You'll need to import activedirectory module first before running these commands. (import-module ActiveDirectory))

  • To see a computer's NetbootGUID

Get-ADComputer -Identity ComputerName -Properties NetbootGuid

 

  • To clear a computer's NetbootGUID

 Set-ADComputer -Identity ComputerName -clear NetbootGUID

  • To list all computers have NetboodGUID value

Get-ADComputer -Filter {NetbootGUID -like "*"} -Properties NetbootGUID

  • To list all computers have NetboodGUID value by formatted output

Get-ADComputer -Filter {NetbootGUID -like "*"} -Properties NetbootGUID,created | Format-List -Property name,distinguishedName,created,NetbootGUID

  • To list all computers older than a week and have NetboodGUID value by formatted output

Get-ADComputer -Filter {NetbootGUID -like "*"} -Properties NetbootGUID,Created | ? {$_.Created -le ((get-date).addDays(-7))} | Format-List -Property name,distinguishedName,created,NetbootGUID

  • To clear NetbootGUID from all computers older than a week and have NetbootGUID value

Get-ADComputer -Filter {NetbootGUID -like "*"} -Properties name,NetbootGUID,Created | ? {$_.Created -le ((get-date).addDays(-7))} | Set-ADComputer -clear NetbootGUID

  • To clear NetbootGUID from all computers older than a week and have NetbootGUID value (Shorter : we only need Created property for date equation)

Get-ADComputer -Filter {NetbootGUID -like "*"} -Properties Created | ? {$_.Created -le ((get-date).addDays(-7))} | Set-ADComputer -clear NetbootGUID