Snipt.net is closing on December 31st, 2016

For more information, please visit this blog post.

snipt

Ctrl+h for KB shortcuts

Batchfile

List all computer objects in all domains in a forest with their name and last modified date and time attribute.

dsquery * forestroot -filter "(&(objectCategory=Computer)(objectClass=Computer))" -attr name whenChanged -limit 0
https://snipt.net/embed/205f7e20de7286d22abfba9489c0ef8f/
https://snipt.net/raw/205f7e20de7286d22abfba9489c0ef8f/
205f7e20de7286d22abfba9489c0ef8f
bat
Batchfile
2
2016-12-05T02:32:38
True
False
False
/api/public/snipt/21666/
list-all-computer-objects-in-all-domains-in-a-forest-with-their-name-and-last-modified-date-and-time-attribute
<table class="highlighttable"><tr><td class="linenos"><div class="linenodiv"><pre><a href="#L-1">1</a></pre></div></td><td class="code"><div class="highlight"><pre><span></span><span id="L-1"><a name="L-1"></a>dsquery * forestroot -filter <span class="s2">&quot;(&amp;(objectCategory=Computer)(objectClass=Computer))&quot;</span> -attr name whenChanged -limit 0 </span></pre></div> </td></tr></table>
ad, computer, lastmod, ldap, windows

Batchfile

List all computer objects in the domain with their name and last modified date and time attributed.

dsquery * domainroot -filter "(&(objectCategory=Computer)(objectClass=Computer))" -attr name whenChanged -limit 0
https://snipt.net/embed/93ec9d1a4ecb971deffc76f117e81f8a/
https://snipt.net/raw/93ec9d1a4ecb971deffc76f117e81f8a/
93ec9d1a4ecb971deffc76f117e81f8a
bat
Batchfile
1
2016-12-05T02:32:42
True
False
False
/api/public/snipt/21665/
list-all-computer-objects-in-the-domain-with-their-name-and-last-modified-date-and-time-attributed
<table class="highlighttable"><tr><td class="linenos"><div class="linenodiv"><pre><a href="#L-1">1</a></pre></div></td><td class="code"><div class="highlight"><pre><span></span><span id="L-1"><a name="L-1"></a>dsquery * domainroot -filter <span class="s2">&quot;(&amp;(objectCategory=Computer)(objectClass=Computer))&quot;</span> -attr name whenChanged -limit 0 </span></pre></div> </td></tr></table>
ad, computer, lastmod, ldap, windows

Batchfile

Get user group membership info, search all domains in a forest.

dsquery user forestroot -name “username” | dsget user -memberof
https://snipt.net/embed/924332e78f9242eb0140d7bd97d12772/
https://snipt.net/raw/924332e78f9242eb0140d7bd97d12772/
924332e78f9242eb0140d7bd97d12772
bat
Batchfile
2
2016-12-05T02:32:47
True
False
False
/api/public/snipt/21649/
get-user-group-membership-info-search-all-domains-in-a-forest
<table class="highlighttable"><tr><td class="linenos"><div class="linenodiv"><pre><a href="#L-1">1</a></pre></div></td><td class="code"><div class="highlight"><pre><span></span><span id="L-1"><a name="L-1"></a>dsquery user forestroot -name “username” <span class="p">|</span> dsget user -memberof </span></pre></div> </td></tr></table>
ad, ldap, user-membership, windows

Batchfile

Enumerate users in Windows AD group.

dsquery group -name “Group Name Here” | dsget group -members -expand
https://snipt.net/embed/9e86f4043196017b27be3ca8a55a6d77/
https://snipt.net/raw/9e86f4043196017b27be3ca8a55a6d77/
9e86f4043196017b27be3ca8a55a6d77
bat
Batchfile
1
2016-12-05T02:32:51
True
False
False
/api/public/snipt/21647/
enumerate-users-in-windows-ad-group
<table class="highlighttable"><tr><td class="linenos"><div class="linenodiv"><pre><a href="#L-1">1</a></pre></div></td><td class="code"><div class="highlight"><pre><span></span><span id="L-1"><a name="L-1"></a>dsquery group -name “Group Name Here” <span class="p">|</span> dsget group -members -expand </span></pre></div> </td></tr></table>
ad, ldap, windows

Bash

Get max gidNumber from LDAP Directory

ldapsearch -D cn=Manager,dc=example,dc=com -xW -b ou=People,dc=example,dc=com | grep gidNumber | sed s/'gidNumber: '/''/ | sort -r | head -n1
https://snipt.net/embed/73ec627d170762e6ffdc07a0c6b11e7d/
https://snipt.net/raw/73ec627d170762e6ffdc07a0c6b11e7d/
73ec627d170762e6ffdc07a0c6b11e7d
bash
Bash
1
2016-12-03T18:46:25
True
False
False
/api/public/snipt/4665/
get-max-gidnumber-from-ldap-directory
<table class="highlighttable"><tr><td class="linenos"><div class="linenodiv"><pre><a href="#L-1">1</a></pre></div></td><td class="code"><div class="highlight"><pre><span></span><span id="L-1"><a name="L-1"></a>ldapsearch -D <span class="nv">cn</span><span class="o">=</span>Manager,dc<span class="o">=</span>example,dc<span class="o">=</span>com -xW -b <span class="nv">ou</span><span class="o">=</span>People,dc<span class="o">=</span>example,dc<span class="o">=</span>com <span class="p">|</span> grep gidNumber <span class="p">|</span> sed s/<span class="s1">&#39;gidNumber: &#39;</span>/<span class="s1">&#39;&#39;</span>/ <span class="p">|</span> sort -r <span class="p">|</span> head -n1 </span></pre></div> </td></tr></table>
bash, ldap, user

Bash

LDAP Modify Command

# Modifying LDAP User/Group Properties
ldapmodify -x -D "cn=Manager,dc=ldap,dc=winker,dc=com" -w passwordd -f ./user.ldif
https://snipt.net/embed/8cad7595ab7d2005099b8ef83f2649ee/
https://snipt.net/raw/8cad7595ab7d2005099b8ef83f2649ee/
8cad7595ab7d2005099b8ef83f2649ee
bash
Bash
2
2016-12-04T21:16:03
True
False
False
/api/public/snipt/3967/
ldap-modify-command
<table class="highlighttable"><tr><td class="linenos"><div class="linenodiv"><pre><a href="#L-1">1</a> <a href="#L-2">2</a></pre></div></td><td class="code"><div class="highlight"><pre><span></span><span id="L-1"><a name="L-1"></a><span class="c1"># Modifying LDAP User/Group Properties</span> </span><span id="L-2"><a name="L-2"></a>ldapmodify -x -D <span class="s2">&quot;cn=Manager,dc=ldap,dc=winker,dc=com&quot;</span> -w passwordd -f ./user.ldif </span></pre></div> </td></tr></table>
bash, ldap, openldap

Bash

LDAP Search Commands

1
2
3
# Searching LDAP Containers
ldapsearch -x -b "dc=nasldap,dc=ssbu,dc=qa,dc=com"
ldapsearch -x -b 'dc=nasldap,dc=ssbu,dc=qa,dc=com' '(uid=dauser)'
https://snipt.net/embed/afa58a675a5dd102cbd4cd6b8aea1bfc/
https://snipt.net/raw/afa58a675a5dd102cbd4cd6b8aea1bfc/
afa58a675a5dd102cbd4cd6b8aea1bfc
bash
Bash
3
2016-12-04T21:16:08
True
False
False
/api/public/snipt/3966/
ldap-search-commands
<table class="highlighttable"><tr><td class="linenos"><div class="linenodiv"><pre><a href="#L-1">1</a> <a href="#L-2">2</a> <a href="#L-3">3</a></pre></div></td><td class="code"><div class="highlight"><pre><span></span><span id="L-1"><a name="L-1"></a><span class="c1"># Searching LDAP Containers</span> </span><span id="L-2"><a name="L-2"></a>ldapsearch -x -b <span class="s2">&quot;dc=nasldap,dc=ssbu,dc=qa,dc=com&quot;</span> </span><span id="L-3"><a name="L-3"></a>ldapsearch -x -b <span class="s1">&#39;dc=nasldap,dc=ssbu,dc=qa,dc=com&#39;</span> <span class="s1">&#39;(uid=dauser)&#39;</span> </span></pre></div> </td></tr></table>
bash, ldap, openldap
Copyrighted, illegal, or inappropriate content? Email [email protected].