ADDS PowerShell Commands to Expedite Your Tasks
1. How to get the DFL?PS C:\>
Get
-ADDomain | findstr /
'DomainMode'
2. How to get the FFL?
PS C:\>
Get
-ADForest | findstr /
'ForestMode'
3. How to get the ADDefaultDomainPasswordPolicy?
PS C:\>
Get
-ADDefaultDomainPasswordPolicy
PS C:\>
Get
-ADTrust -f * | ft
PS C:\> get-aduser -f * -Searchbase
"ou=powershell,dc=contoso,dc=com"
-pr SamAccountName,PasswordExpired,whenChanged,UserPrincipalName
PS C:\> get-aduser -f * -pr lastlogondate | ft samaccountname,LastLogonDate,Enabled -auto
11.Reset the password for all users of an OU
PS C:\> Get-ADUser -Filter * -SearchBase
"ou=test,dc=biz,dc=net"
| Set-ADAccountPassword -NewPassword (ConvertTo-SecureString -AsPlainText monster@me123 -Force)
12.Finding Global Catalog
Get-ADForest biz.net | FL GlobalCatalogs
13. Finding last 20 events from Directory Service.
get-eventlog
'Directory Service' -newest 20 | Format-List indx, source, message
14. Find event log entries with a specific text.
Get
-EventLog
System | Where-
Object
{ $_.Message -match
"disk"
}
15. How to get the FSMO?
>>[System.DirectoryServices.ActiveDirectory.Domain]::GetCurrentDomain() |
Select
-
Object
*owner
>>[System.DirectoryServices.ActiveDirectory.Forest]::GetCurrentForest() |
Select
-
Object
*owner
or
Get-ADDomain | select PDCEmulator,RIDMaster,InfrastructureMaster | fl
Get-ADForest | select DomainNamingMaster, SchemaMaster | fl
PowerShell Function to Determine the Active Directory FSMO Role Holders
http://gallery.technet.microsoft.com/scriptcenter/PowerShell-Function-to-bec6c607 -
Written by Mike F Robbins
16. Reboot Report
Get
-EventLog -ComputerName
System | Where-
Object
{ $_.Source -eq
'user32' } | ConvertTo-HTML | Out-File C:\Reboot.htm
17.How to unlock the AD accounts.
Search-ADAccount –LockedOut | Unlock-ADAccount
18. How to find the commands are available in a particular Module.
Get-Command -Module dnsserver
19. DCs Inventory -> Output in a CSV
Get-ADDomainController -Filter * | select name,
operatingsystem,HostName,site,IsGlobalCatalog,IsReadOnly | Export-Csv
c:\dcinventory.csv
No comments:
Post a Comment