Listing all ActiveDirectory User Full Names belonging to a specific group to a textfile
dsget group "CN=GROUP,OU=DEPARTMENT1,OU=Groups,OU=STI,DC=dom,DC=com" -members >>out.txt
Listing all ActiveDirectory User SAM IDs belonging to a specific group to a textfile
dsget group "CN=GROUP,OU=DEPARTMENT1,OU=Groups,OU=STI,DC=dom,DC=com" -members | dsget user -samid >>out.txt
Listing all users from the domain, grouped by logonname, lastname, firstname, fullname – in unicode formatting (important for special characters in names)
dsquery user -limit 0 | dsget user -samid -ln -fn -display -uco >> Users.rtf
Server 2008 Core: Show network interfaces
netsh interface ipv4 show interfaces
Server 2008 Core: Set IP address
netsh interface ipv4 set address name=Idx source=static address=x.x.x.x mask=x.x.x.x gateway=x.x.x.x
Server 2008 Core: Set DNS servers
netsh interface ipv4 add dnsserver name=Idx address=x.x.x.x index=1
Server 2008 Core: Rename computer
netdom renamecomputer OLDNAME /NewName:NEWNAME
Server 2008 Core: Joining computer to a domain
netdom join /domain:x /userd:x /passwordd:*
Server 2008 Core: Creating a new domain
Create a textfile with the following contents (e.g. as c:\unattend.txt):
[DCINSTALL]
AutoConfigDNS=Yes
DomainNetBiosName=domain
NewDomainDNSName=domain.tld
ReplicaOrNewDomain=Domain
NewDomain=Forest
ForestLevel=3
DomainLevel=3
SafeModeAdminPassword=XXX
RebootOnCompletion=Yes
Create the domain:
dcpromo /unattend:c:\unattend.txt
Some reference: http://technet.microsoft.com/en-us/library/cc732887%28WS.10%29.aspx
Server 2008 Core: Enabling remote MMC
netsh advfirewall firewall set rule group="Remote Administration" new enable=yes
Server 2008 Core: Enabling Remote Desktop
cscript C:\Windows\System32\Scregedit.wsf /ar 0
cscript C:\Windows\System32\Scregedit.wsf /cs 0
netsh advfirewall firewall set rule group="Remote Desktop" new enable=yes
Server 2008 Core: Enabling Auto Update and Check for updates immediately
cscript C:\Windows\System32\Scregedit.wsf /au 4
net stop wuauserv
net start wuauserv
wuauclt /detectnow
Server 2008 Core: Enter Product Key and activate
slmgr.vbs -ipk xxxxx-yyyyy-xxxxx-yyyyy-xxxxx
slmgr.vbs -ato
Server 2008 Core: Trolling around with wevtutil
Displaying Type 3 Logon Events
wevtutil qe Security "/q:*[EventData[Data[@Name='LogonType']='3']]" /f:text (/c:x)
Digging through the nodes [xxx[yyy[…]], “@” means “attribute”
<Event ...>
<System>
...
</System>
<EventData>
...
<Data Name='LogonType'>3</Data>
...
</EventData>
</Event>
Displaying only Errors and Warnings
wevtutil qe Application "/q:*[System[(Level=2 or Level=3)]]" /f:text (/c:x)
Available levels:
Level 4 Information
Level 3 Warning
Level 2 Error
Level 1 Critical
Display all Security entries logged after 13:00 on 17.03.2011
wevtutil qe Security /c:3 "/q:*[System[TimeCreated[@SystemTime > '2011-03-17T13:00:00.0000Z']]]" /f:text
Server 2008 Core: Display all available roles
oclist
Server 2008 Core: Installing a role
start /w ocsetup ROLENAME
Server 2008: Setting IE proxy as system default
netsh
winhttp
import proxy source=ie
Scripting: Returning/passing through a returncode of a script called through a batch file
@echo off
cd /d %~dp0
cscript //Nologo xyz.vbs
exit /B %errorlevel%