Monday 9 July 2018

Command Prompt and AD Troubleshoot

Network Location Test - List domain controllers(DCs), Query the status of trust.

##AD Server

1. Verify DCs in a domain
In this example, the /dclist parameter is used to create a list of domain controllers of the domain fourthcoffee.com
nltest /dclist:fourthcoffee
Output displays similar to the following:
Get list of DCs in domain 'ntdev' from '\\fourthcoffee-dc-01'.
    fourthcoffee-dc-01.forthcoffee.com       [DS] Site: Rome
    fourthcoffee-dc-03.forthcoffee.com       [DS] Site: LasVegas
    fourthcoffee-dc-04.forthcoffee.com       [DS] Site: LA
    fourthcoffee-dc-09.forthcoffee.com       [DS] Site: NYC
    fourthcoffee-dc-12.forthcoffee.com       [DS] Site: Paris
    fourthcoffee-dc-24.forthcoffee.com       [DS] Site: Chattaroy
    fourthcoffee-dc-32.forthcoffee.com       [DS] Site: Haifa
    fourthcoffee-dc-99.forthcoffee.com       [DS] Site: Redmond
    fourthcoffee-dc-63.forthcoffee.com [PDC] [DS] Site: London
The command completed successfully

2. Show trust relationships for a domain
In this example, you want to view the established trust relationships for your domain. At the command prompt, type:
nltest /domain_trusts
Output displays similar to the following:
List of domain trusts:
    0: forthcoffee forthcoffee.com (NT 5) (Forest Tree Root) (Primary Domain)
The command completed successfully
This example shows that one domain is trusting itself and no others.

3. check FSMO roles
Forest Wide Roles: Schema Master, Domain naming master
Domain Wide Roles: PDC, RID pool manager, Infrastructure Master

netdom query fsmo












4. check user password expires
#/domain = This switch forces net user to execute on the current domain controller instead of the local computer.

net user [user] /domain









##########################################################
System Information:
1. Click Start and Run.
2. Type msinfo32 and press Enter.



























Get Serial Number:
C:\WINDOWS\system32>wmic bios get serialnumber


Get Memory Info:
C:\WINDOWS\system32>wmic MemoryChip get BankLabel, Capacity, MemoryType, TypeDetail, Speed, DeviceLocator

C:\WINDOWS\system32>wmic MemoryChip list full


Collect ping result in txt:
C:\Users\Administrator>ping 8.8.8.8 -t > c:\pingdns.txt

###########################################################
Top Active Directory Tools:
https://www.ittsystems.com/best-free-active-directory-tools/

AD Info - Active Directory Reporting Tool:
http://www.cjwdev.com/Software/ADReportingTool/Info.html




WiseSoft Bulk AD Users:
http://www.wisesoft.co.uk/software/bulkadusers/default.aspx


#######################################################
To show user connect to which DC:
C:\WINDOWS\system32>echo %logonserver%
\\DC001
 
C:\WINDOWS\system32>set L
LOCALAPPDATA=C:\Users\mike.choo\AppData\Local
LOGONSERVER=\\DC001

#######################################################

To show users in which OU:















#######################################################

Delete cached temporarily credentials for a network share:

net use    #view current network connection

net use * /d       #delete all network authentication

net use \\10.10.10.10\folder /u:DOMAIN\USER password

klist purge      #remove the Kerberos authentication ticket 
 
#######################################################
 
In windows 10, to enable offline files, click Enable offline files

































To disable offline files, click Disable offline files in the Offline Files window.






































#######################################################
Generating HTML Reports: All GPOs
 
In PS: PS C:\> Get-GPOReport -All -ReportType Html -Path "C:\All-GPOs.html"
 
In CMD: C:\>gpresult /h gpo.htm

#######################################################
Search AD powershell for mobile:

Search by user: Get-ADUser michael.wong -Properties mobile

Search by mobile: 
get-aduser -filter {Mobile -like "+60 123456789"} -prop DisplayName | select SamAccountName

get-aduser -filter {Mobile -like "*123456789"} -prop DisplayName | select SamAccountName

#######################################################
Check Domain and Forest Functional Level:

Method 1:
To find the Domain Functional Level:
Get-ADDomain | fl Name,DomainMode






To find the Forest Functional Level:
Get-ADForest | fl Name,ForestMode






Method 2:
1) “Active Directory Domains and Trusts” or “Active Directory Users and Computers“
2) Right-click the root domain, then select “Properties“.