Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR SHELL

join computer to domain powershell script

$stale = (Get-Date).AddDays(-30) # means 30 days since last logon, can be changed to any number.

Get-ADComputer -Property Name,lastLogonDate -Filter {lastLogonDate -lt $stale} | FT Name,lastLogonDate

Get-ADComputer -Property Name,lastLogonDate -Filter {lastLogonDate -lt $stale} | Remove-ADComputer
Source by blog.netwrix.com #
 
PREVIOUS NEXT
Tagged: #join #computer #domain #powershell #script
ADD COMMENT
Topic
Name
6+2 =