Prin utilizarea acestui site, sunteți de acord cu Politica de confidențialitate.
Accepta
EnterineEnterineEnterine
  • ACASĂ
  • Pro
  • Tehnologie
  • Microsoft
    • Azur
    • ConfigMgr/SCCM
    • Dpm
    • Orchestrator
    • Hyper-V
    • Microsoft Edge Insider
    • MSI
    • Birou 365
    • Office Insider
    • Putere bi
    • Skype
    • Server SQL
    • Echipe
  • Ferestre
    • Centrul de administrare Windows
    • Client Windows
    • Windows Server
  • Lista de colecție de interogări SCCM
Lectură: How to Find Inactive Computers in Active Directory using PowerShell
Redimensionare fontAa
EnterineEnterine
Redimensionare fontAa
  • ACASĂ
  • Pro
  • Tehnologie
  • Microsoft
  • Ferestre
  • Lista de colecție de interogări SCCM
Căutare
  • ACASĂ
  • Pro
  • Tehnologie
  • Microsoft
    • Azur
    • ConfigMgr/SCCM
    • Dpm
    • Orchestrator
    • Hyper-V
    • Microsoft Edge Insider
    • MSI
    • Birou 365
    • Office Insider
    • Putere bi
    • Skype
    • Server SQL
    • Echipe
  • Ferestre
    • Centrul de administrare Windows
    • Client Windows
    • Windows Server
  • Lista de colecție de interogări SCCM
IT Pro

How to Find Inactive Computers in Active Directory using PowerShell

Publicat: February 11, 2024
1 Min Citește
Cota

How to Find Inactive Computers in Active Directory using PowerShell.

To identify inactive computer accounts, you will always target those that have not logged on to Active Directory in the last 90 days. To accomplish this goal, you need to target theLastLogonTimeStamp property and then specify a condition with the time as shown in the following PowerShell commands:

$DaysInactive = 90

$time = (Get-Date).Adddays(-($DaysInactive))

Get-ADComputer -Filter {LastLogonTimeStamp -lt $time} -ResultPageSize 2000 -resultSetSize $null -Properties Name, OperatingSystem, SamAccountName, DistinguishedName

If you wish to search computer accounts that have been inactive for more than 90 days, all you need to do is modify the$DaysInActive variable value. The current value is set at 90 days; however, you can specify your own value.

To export output to a CSV file, add theExport-CSV PowerShell cmdlet as shown in the following command:

Get-ADComputer -Filter {LastLogonTimeStamp -lt $time} -ResultPageSize 2000 -resultSetSize $null -Properties Name, OperatingSystem, SamAccountName, DistinguishedName | Export-CSV "C:\Temp\StaleComps.CSV" –NoTypeInformation
Etichetat:Active DirectoryMicrosoft Windows ServerPowerShellWindows
Articolul precedent Lista de colecție de interogări din Configuration Manager Configuration Manager Scan failed with error 0x80244022
Articolul următor Windows Admin Center Preview 1812 released
2 Comments 2 Comments
  • fernan says:
    January 13, 2022 at 4:05 am

    ¿Porqué me devuelve en algunas cuentas Enabled: True?

    Reply
    • Andrej Prijmak says:
      January 13, 2022 at 6:09 am

      Hi. Can you add any screenshots for this?

      Reply

Lasă un răspuns Anulează răspunsul

Adresa ta de e-mail nu va fi publicată. Câmpurile obligatorii sunt marcate *

Acest site folosește Akismet pentru a reduce spamul. Aflați cum sunt procesate datele comentariilor dvs.

Traducere

English中文(简体)DanskNederlandsFrançaisDeutschItaliano한국어PolskiPortuguêsRomânăEspañolУкраїнська
de Transposh - translation plugin for wordpress

Postări populare

Cerințe de sistem pentru Windows Server 2016
Windows Server
Lista de colecție de interogări din Configuration Manager
Lista de colecție de interogări din Configuration Manager
Configmgr
Navigarea structurată/gestionată este activată în paginile moderne din site-urile clasice ale echipelor
Teh
SCCM nu s-a obținut locațiile DP ca versiune așteptată de la MP
Configmgr

Postări recente

Instalarea și configurarea Fail2ban pentru protecție SSH pe Ubuntu 24.04
Linux
Activarea și configurarea FirewallD pe AlmaLinux
Linux
Crearea utilizatorilor și configurarea cheii SSH în AlmaLinux
Linux
Cum să resetați parola pe AlmaLinux
Linux

© 2023 Enterine

Accesați versiunea mobilă
Bine ai revenit!

Conectați-vă la contul dvs

Nume de utilizator sau adresă de e-mail
Parolă

Ți-ai pierdut parola?