One Liners: DSQUERY | DSGET
Required: Remote Server Installation Tools
Most Used
Less Used
Get members of an AD Group:
- dsget group "CN=Blah,OU=Blah,DC=domain,DC=domainsuffix" -members
Find the number of mailboxes on the specified msExchHomeServerName
- dsquery * -filter "(&(objectClass=User)(objectCategory=Person)(mailnickname=*)(msExchHomeServerName=*servername*))" -limit 0 | find /i /c "cn"
Query for global security or distribution groups
- dsquery * -filter "(&(groupType:1.2.840.113556.1.4.803:=2))"
Query for global security groups
- dsquery * -filter "(&(groupType:1.2.840.113556.1.4.803:=-2147483646))"
Find the domain controller GUID of the specified DC
- dsquery * "CN=dcname,OU=Domain Controllers,DC=domainRoot" -scope base -attr objectguid
Find the domain GUID
- dsquery * "domainRoot" -scope base -attr objectGUID
Find DFS roots from Active Directory
- dsquery * "CN=Dfs-Configuration,CN=System,domainRoot" -filter "(objectClass=fTDfs)"
Find the Exchange storage groups known to AD
- dsquery * "CN=Configuration,domainRoot" -filter "(&(objectClass=msExchStorageGroup))" -attr name msExchESEParamCircularLog msExchESEParamEventSource msExchESEParamLogFilePath msExchESEParamLogFileSize msExchESEParamSystemPath msExchESEParamZeroDatabaseDuringBackup msExchRecovery msExchESEParamEnableOnlineDefrag msExchESEParamEnableIndexChecking msExchESEParamBaseName msExchESEParamCommitDefault msExchESEParamDbExtensionSize msExchESEParamPageTempDBMin msExchESEParamPageFragment msExchESEParamCheckpointDepthMax
Find AdminSDHolder / SDPROP groups in the directory
- dsquery * -filter "(&(objectClass=Group)(objectCategory=Group)(adminCount=1))"
- Query for all objects that are protected (that are members of the groups above)
- dsquery * -filter "(adminCount=1)"
- Count how many user accounts are protected by the SDPROP process
- dsquery * -filter "(&(objectClass=User)(objectCategory=Person)(adminCount=1))" | find /i /c "CN="
Find SCPs (Service Connection Points) for objects other than print queues
- dsquery * -filter "&((objectClass=ConnectionPoint)(!(objectClass=PrintQueue)))" -limit 0
Check a 2008 R2 schema forest prep has run successfully (rvevision=5)
- dsquery * "CN=ActiveDirectoryUpdate,CN=ForestUpdates,CN=Configuration,domainRoot" -attr * -scope base
- Check a 2008 R2 schema domain prep has run successfully (revision=5)
- dsquery * "CN=ActiveDirectoryUpdate,CN=DomainUpdates,CN=System,domainRoot" -attr * -scope base
- Find the infrastructure role holder for the DNS domain application partition
- dsquery * "CN=Infrastructure,DC=DomainDNSZones,domainRoot" -attr fSMORoleOwner
- Find the application partitions from the forest root configuration NC
- dsquery * "CN=Partitions,CN=Configuration,domainRoot" -filter "(&(objectClass=crossRef)(msDS-SDReferenceDomain=*))" -attr ncName dnsRoot
- Find computer accounts not server, XP or Vista
- dsquery * domainroot -filter "(&(objectCategory=Computer)(objectClass=Computer)(&(!(operatingSystem=*prof*)(!(operatingSystem=*server*)(!(operatingSystem=*vista*))))))" -limit 0 -attr CN operatingSystem operatingSystemVersion
- Find SPNs from the directory
- dsquery * -filter "(servicePrincipalName=*)" -attr cn servicePrincipalName -limit 0
- Query a list of groups and determine the group type (global/local/universal)
- dsquery group -name *groupfilter* | dsget group -scope -secgrp -dn
No comments:
Post a Comment