<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Praetorian Prefect &#187; active directory</title>
	<atom:link href="http://praetorianprefect.com/archives/tag/active-directory/feed/" rel="self" type="application/rss+xml" />
	<link>http://praetorianprefect.com</link>
	<description>Information security, a little slower...a little deeper</description>
	<lastBuildDate>Thu, 29 Jul 2010 16:38:31 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.9.2</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>Server 2008 R2: Active Directory Functional Levels</title>
		<link>http://praetorianprefect.com/archives/2009/10/server-2008-r2-active-directory-functional-levels/</link>
		<comments>http://praetorianprefect.com/archives/2009/10/server-2008-r2-active-directory-functional-levels/#comments</comments>
		<pubDate>Tue, 06 Oct 2009 09:12:14 +0000</pubDate>
		<dc:creator>Simon Price</dc:creator>
				<category><![CDATA[Administration]]></category>
		<category><![CDATA[Networking]]></category>
		<category><![CDATA[Security]]></category>
		<category><![CDATA[windows]]></category>
		<category><![CDATA[active directory]]></category>
		<category><![CDATA[federation services]]></category>
		<category><![CDATA[kerberos]]></category>
		<category><![CDATA[ldap]]></category>
		<category><![CDATA[Microsoft]]></category>
		<category><![CDATA[powershell]]></category>
		<category><![CDATA[server]]></category>
		<category><![CDATA[windows 2008]]></category>

		<guid isPermaLink="false">http://praetorianprefect.com/?p=758</guid>
		<description><![CDATA[Windows Server 2008 R2 was released in August, and it introduced new functional levels for Active Directory. This article takes a look back at the different functional levels of the past and what is new in the latest release of the server operating system for Active Directory (yes, a recycle bin for AD objects!).

Functional levels [...]]]></description>
			<content:encoded><![CDATA[<p>Windows Server 2008 R2 was released in August, and it introduced new functional levels for Active Directory. This article takes a look back at the different functional levels of the past and what is new in the latest release of the server operating system for Active Directory (yes, a recycle bin for AD objects!).</p>

<p>Functional levels were first introduced when Active Directory made its appearance in Windows 2000 Server. They allowed you to run different versions of domain controllers in your environment, and when all the domain controllers were brought up to a certain version of Windows, you could raise the functional levels to gain the added features of that operating system version. Now that Windows 2008 R2 is released, it is unlikely that you will mass deploy this new operating system to your entire forest or domain. Instead, you&#8217;ll deploy a single domain controller and kick the tires, so to speak. The time will eventually come when you&#8217;ve upgraded every domain controller to R2, and at that point you can raise the functional level to 2008 R2 to take advantage of the new features.</p>

<p>Functional levels can be raised in domains or, as of Windows 2003 Server, in the forest, providing different features in each. They are differentiated by labeling them Domain Functional Level and Forest Functional Level.</p>

<h3>What&#8217;s new in 2008 R2</h3>

<h4><u>Domain Functional Level</u></h4>

<p>There are two features added when raising the domain functional level to 2008 R2. They are Authentication Mechanism Assurance and Automatic SPN Management.</p>

<p><strong>Authentication mechanism assurance</strong> is meant for domains that utilize federation services (ADFS) or certificate-based authentication methods, such as smart card or token-based authentication. This mechanism adds information to the user&#8217;s kerberos token on the type of authentication used. This allows administrators to modify group membership based on how the user authenticates. For example, a user can have access to different resources if they log in with a certificate versus when they log in with just their username and password.</p>

<p><strong>Automatic SPN management</strong> provides a method for managing service accounts for applications such as Exchange, SQL and IIS. In the past, regular domain accounts were used for these purposes, adding management headaches in terms of password management and service principle names (SPNs). This new feature provides the following benefits:</p>

<ul>
<li>A class of domain accounts can be used to manage and maintain services on local computers.</li>
<li>Passwords for these accounts will be reset automatically.</li>
<li>Do not have to complete complex SPN management tasks to use managed service accounts.</li>
<li>Administrative tasks for managed service accounts can be delegated to non-administrators.</li>
</ul>

<h4><u>Forest Functional Level</u></h4>

<p>There is one new feature in raising the forest functional level to Server 2008 R2, and it is long overdue. It is the Active Directory recycle bin. In the days of old, when an IT administrator or help desk operator accidentally deleted an OU filled with user or computer objects (this has happened more times than you would think), there would be a scramble to perform a restore. The delete replicates to all domain controllers, so an authoritative restore in Active Directory restore mode from a good backup using NTDSutil would be in order. With 2008 R2 forest functional level, a powershell cmd-let will undo this instantly.</p>

<p>Note that this feature is not enabled automatically when raising forest functional level. Additionally, you must run the following command in the Active Directory Module for Powershell.</p>

<pre><code>Enable-ADOptionalFeature –Identity ‘CN=Recycle Bin Feature,CN=Optional Features,CN=Directory
Service,CN=Windows NT,CN=Services,CN=Configuration, DC=mydomain,DC=com’
–Scope ForestOrConfigurationSet –Target ‘mydomain.com’
</code></pre>

<h4>Functional levels of previous version</h4>

<p>The following are the previous functional levels and what features they added, as documented in <a href="http://technet.microsoft.com/en-us/library/cc771132(WS.10).aspx">Technet</a>.</p>

<hr />

<h3>Domain Functional Levels:</h3>

<h4>Windows 2000 Native:</h4>

<ul>
<li>Universal groups are enabled for both distribution groups and security groups.</li>
<li>Group nesting.</li>
<li>Group conversion is enabled, which makes conversion between security groups and distribution groups possible.</li>
<li>Security identifier (SID) history.</li>
</ul>

<h4>Windows Server 2003</h4>

<ul>
<li>The availability of the domain management tool, <code>Netdom.exe</code>, to prepare for domain controller rename.</li>
<li>Update of the logon time stamp. The <code>lastLogonTimestamp</code> attribute will be updated with the last logon time of the user or computer. This attribute is replicated within the domain.</li>
<li>The ability to set the <code>userPassword</code> attribute as the effective password on <code>inetOrgPerson</code> and user objects.</li>
<li>The ability to redirect Users and Computers containers. By default, two well-known containers are provided for housing computer and user/group accounts: namely, <code>cn=Computers</code>, and <code>cn=Users,</code>. This feature makes possible the definition of a new well-known location for these accounts.</li>
<li>Makes it possible for Authorization Manager to store its authorization policies in Active Directory Domain Services (AD DS).</li>
<li>Includes constrained delegation so that applications can take advantage of the secure delegation of user credentials by means of the Kerberos authentication protocol. Delegation can be configured to be allowed only to specific destination services.</li>
<li>Supports selective authentication, through which it is possible to specify the users and groups from a trusted forest who are allowed to authenticate to resource servers in a trusting forest.</li>
</ul>

<h4>Windows Server 2008</h4>

<ul>
<li>Distributed File System (DFS) Replication support for SYSVOL, which provides more robust and detailed replication of SYSVOL contents.</li>
<li>Advanced Encryption Services (AES 128 and 256) support for the Kerberos authentication protocol.</li>
<li>Last Interactive Logon Information, which displays the time of the last successful interactive logon for a user, from what workstation, and the number of failed logon attempts since the last logon.</li>
<li>Fine-grained password policies (FGPP), which make it possible for password and account lockout policies to be specified for users and global security groups in a domain.</li>
</ul>

<h3>Forest Functional Levels:</h3>

<h4>Windows 2000:</h4>

<p>There were no forest functional levels, just domain.</p>

<h4>Windows Server 2003:</h4>

<ul>
<li>Forest trust.</li>
<li>Domain rename.</li>
<li>Linked-value replication (changes in group membership store and replicate values for individual members instead of replicating the entire membership as a single unit). This change results in lower network bandwidth and processor usage during replication and eliminates the possibility of lost updates when different members are added or removed concurrently at different domain controllers.</li>
<li>The ability to deploy a read-only domain controller (RODC) that runs Windows Server 2008.</li>
<li>Improved Knowledge Consistency Checker (KCC) algorithms and scalability. The Intersite Topology Generator (ISTG) uses improved algorithms that scale to support forests with a greater number of sites than can be supported at the Windows 2000 forest functional level. The improved ISTG election algorithm is a less intrusive mechanism for choosing the ISTG at the Windows 2000 forest functional level.</li>
<li>An improved ISTG algorithm (better scaling of the algorithm that the ISTG uses to connect all sites in the forest).</li>
<li>The ability to create instances of the dynamic auxiliary class called dynamicObject in a domain directory partition.</li>
<li>The ability to convert an <code>inetOrgPerson</code> object instance into a User object instance, and the reverse.</li>
<li>The ability to create instances of the new group types, called application basic groups and Lightweight Directory Access Protocol (LDAP) query groups, to support role-based authorization.</li>
<li>Deactivation and redefinition of attributes and classes in the schema.</li>
</ul>

<h4>Windows Server 2008:</h4>

<p>No forest functional level changes occurred from Windows 2003 to Windows 2008.</p>

<p><strong>Related Posts:</strong></p>
<ul>
<li><a href="http://praetorianprefect.com/archives/2010/06/iphone-4-ordering-and-session-switching/">iPhone 4 Ordering and Session Switching</a></li>
<li><a href="http://praetorianprefect.com/archives/2010/05/mays-patch-tuesday/">May&#8217;s Patch Tuesday</a></li>
<li><a href="http://praetorianprefect.com/archives/2010/03/3473/">March&#8217;s Patch Tuesday</a></li>
<li><a href="http://praetorianprefect.com/archives/2010/03/press-f1-for-help-pwned/">Press F1 for Help, pwned.</a></li>
<li><a href="http://praetorianprefect.com/archives/2010/01/disable-acrobat-reader-pdf-in-the-enterprise/">Using Group Policy to Disable JavaScript in Adobe PDF Files</a></li>
</ul><br />
]]></content:encoded>
			<wfw:commentRss>http://praetorianprefect.com/archives/2009/10/server-2008-r2-active-directory-functional-levels/feed/</wfw:commentRss>
		<slash:comments>7</slash:comments>
		</item>
		<item>
		<title>2008 Server to the Core</title>
		<link>http://praetorianprefect.com/archives/2009/09/2008-server-to-the-core/</link>
		<comments>http://praetorianprefect.com/archives/2009/09/2008-server-to-the-core/#comments</comments>
		<pubDate>Wed, 23 Sep 2009 21:47:06 +0000</pubDate>
		<dc:creator>Simon Price</dc:creator>
				<category><![CDATA[Administration]]></category>
		<category><![CDATA[Featured]]></category>
		<category><![CDATA[Networking]]></category>
		<category><![CDATA[Security]]></category>
		<category><![CDATA[active directory]]></category>
		<category><![CDATA[cli]]></category>
		<category><![CDATA[firewall]]></category>
		<category><![CDATA[Microsoft]]></category>
		<category><![CDATA[scripting]]></category>
		<category><![CDATA[windows]]></category>
		<category><![CDATA[windows 2008]]></category>

		<guid isPermaLink="false">http://praetorianprefect.com/?p=398</guid>
		<description><![CDATA[One of my favorite websites in the days of Windows 2000 Server was a project from a group of system managers from the Department of Electrical Engineering at the Swiss Federal Institute of Technology; it was titled “Real Men Don&#8217;t Click”, and it was dedicated to accomplishing tasks solely using the command line interface (CLI). [...]]]></description>
			<content:encoded><![CDATA[<p>One of my favorite websites in the days of Windows 2000 Server was a project from a group of system managers from the Department of Electrical Engineering at the Swiss Federal Institute of Technology; it was titled “Real Men Don&#8217;t Click”, and it was dedicated to accomplishing tasks solely using the command line interface (CLI). I was glad to see I wasn&#8217;t the only CLI fan in the Windows world who wasn&#8217;t inherently a former UNIX guy. Well, discounting the fact our friends at SFIT were inherently UNIX guys, they were very fair in their presentation of how to get around in the CLI.</p>

<p>This article is not just for the CLI fans like me, who snicker when forced to grab at the mouse for tasks they much prefer taking on in that wonderful black box with the blinking cursor; but for anyone who will deploy a core installation of Windows. This is not an anti-GUI rant, but a look into the CLI, and one that is much needed after Microsoft released Windows 2008 Server Core Edition.</p>

<p>Microsoft started to return CLI tools back to administrators in Windows 2000 when they released <code>netsh.exe</code>. More and more CLI options surfaced with releases of Support Tools, Resource Kits, and the popular PS suite from SysInternals (now Microsoft). The most recent evidence of the resurgence of the CLI is Windows 2008 Server Core Edition. This version is entirely driven with the command line interface.</p>

<p>The following roles are supported in a core installation:</p>

<ul>
    <li>Active Directory Certificate Services</li>
    <li>Active Directory Domain Services</li>
    <li>Active Directory Lightweight Directory Services (AD LDS)</li>
    <li>DHCP Server</li>
    <li>DNS Server</li>
    <li>File Services (including File Server Resource Manager)</li>
    <li>Hyper-V</li>
    <li>Print and Document Services</li>
    <li>Web Server (including a subset of ASP.NET)</li>
</ul>

<p>Why choose core over a standard installation? A core setup will only install the binaries needed by the server roles. Microsoft claims that if Windows 2000 Server had a core edition, it would have had a <strong>60% reduction</strong> in patches (40% in Windows 2003). This is a considerable amount of patches for critical servers such as domain controllers.</p>

<p>So let’s get started with some administration tasks in Windows 2008 Server Core Edition: getting things up and running, configuring roles, promoting to a domain controller, and essentially running a version of Microsoft&#8217;s OS that does not include explorer.exe. (What? No Desktop?)</p>

<p>The following commands were executed on an installation of Microsoft Windows 2008 Server Core Standard R2. For those who don&#8217;t have the time to muck with the CLI, R2 has included a new VBScript (<strong>sconfig.vbs</strong>) which provides a menu driven server configuration tool to quickly get through these steps. However, I recommend doing it the long way at least once to understand what&#8217;s happening in case you run into issues in the future. The install is straightforward, so details not needed. Most important is the option of which version of the OS to install, which I selected Windows 2008 R2 Standard (Server Core Installation). After a dialog to set the administrator password, I&#8217;m left with a DOS prompt.</p>

<p><strong><span style="text-decoration: underline;">GETTING STARTED</span></strong></p>

<p>First things first, IP connectivity. I&#8217;ll be using 192.168.1.0/24 for the network:</p>

<p><em><span style="font-size: xx-small;">Note: netsh.exe allows you to add all the options/parameters in one line, or you can run netsh.exe and go into each configuration category, (ie. interface), then eventually when deep enough into the options, execute the command, (ie. set). To keep it simple, I&#8217;ll write out the commands in single lines, but definitely run netsh.exe with no options and look into the many configuration areas available.</span></em></p>

<p>Let’s list available network interfaces to see which one we need to configure:</p>

<pre><code>netsh interface ipv4 show interfaces
</code></pre>

<p>Result:
<pre><code>
  Idx     Met        MTU           State                Name
  &ndash;--  ----------  ----------  ------------  ---------------------------
    3           5        1500  connected     Local Area Connection
    1          50  4294967295  connected     Loopback Pseudo-Interface 1
</code></pre>
Now, Local Area Connection is what I’m interested in, which Idx=3. Let&#8217;s set an IP to that interface:</p>

<pre><code>netsh int ipv4 set address name=3 source=static address=192.168.1.25 mask=255.255.255.0 gateway=192.168.1.1
</code></pre>

<p>Note the name=3 parameter; 3 was the IDX number retrieved in the previous step. You will not get a resulting output, but you can double check your settings by running <strong>ipconfig /all</strong>.</p>

<p>Next step is to add DNS servers for name resolution. If this will be the first Domain Controller in the Forest and will run DNS, you can skip this, otherwise, add your DNS servers now (the example assumes DNS servers 192.168.1.20 and 192.168.1.21):</p>

<pre><code>netsh interface ipv4 add dnsserver name=3 address=192.168.1.20 index=1
</code></pre>

<p>add a secondary dns server:</p>

<pre><code>netsh interface ipv4 add dnsserver name=3 address=192.168.1.21 index=2
</code></pre>

<p>Note that we used the name=3 parameter again to add these DNS entries to the network interface we are interested in. Once again, you can double check your settings with <strong>ipconfig /all</strong>.</p>

<p>Now we have connectivity. Let&#8217;s rename the computer and join a domain. Windows had assigned a random computer name, you can see what it is by typing <strong>hostname</strong>. Mine happened to be WIN-EPNB8G5FAUI. Let&#8217;s rename this to CORE-DEV:</p>

<pre><code>netdom renamecomputer %COMPUTERNAME% /NewName:CORE:DEV
</code></pre>

<p>You will be warned about the potential hazards of renaming the computer, not our concern since this is a brand new installation. Proceed, and you will have the following results:</p>

<pre><code>The computer needs to be restarted in order to complete the operation.

The command completed successfully.
</code></pre>

<p>Restart the computer by typing: <strong>shutdown /r /t 001</strong></p>

<p>After restarting, log back in, and let&#8217;s join a domain. Our test domain is called testdom.local. We will use an account called admin to join the domain:</p>

<pre><code>netdom join CORE-DEV /domain:testdom.local /userd:testdom\admin /passwordd:*
</code></pre>

<p align="left">The * for the password option will prompt you for the password. A reboot is again required.</p>

<p>Now you can log in with a domain account by choosing other user, then typing domain\user for the user.</p>

<p><strong><span style="text-decoration: underline;">ACTIVATION</span></strong></p>

<p>Now, let&#8217;s activate Windows. In R2, you enter the license key with slmgr.vbs (prior to R2, the installation setup prompted for the license key).</p>

<pre><code>slmgr.vbs –ipk ABCDE-FGHIJ-KLMNO-PQRST-UVWXY
</code></pre>

<p>Next, activate:</p>

<pre><code>slmgr.vbs -ato
</code></pre>

<p>If successful, you will not receive any messages back.</p>

<p><strong>
<span style="text-decoration: underline;">CONFIGURING AUTOMATIC UPDATES</span></strong></p>

<p>I recommend controlling the behavior of automatic updates with Group Policy, but if you need to toggle the settings, here are the commands:</p>

<p>To verify the current setting:</p>

<pre><code>cscript scregedit.wsf /AU /v
</code></pre>

<p>To enable automatic updates:</p>

<pre><code>cscript scregedit.wsf /AU 4
</code></pre>

<p>To disable automatic updates:</p>

<pre><code>cscript scregedit.wsf /AU 1
</code></pre>

<p>To check for updates:</p>

<pre><code>wuauclt /detectnow
</code></pre>

<p><strong><span style="text-decoration: underline;">
FIREWALL</span></strong></p>

<p>Let&#8217;s take a look at the firewall now, since we will want to open up some rules to perform remote administrations tasks, such as using Remote Desktop or MMC tools to manage the server.</p>

<p>We can take a look at the firewall profiles by typing:</p>

<pre><code>netsh advfirewall show allprofiles
</code></pre>

<p>If you have a domain profile applied via GPO, then those will apply. You can also look at all the rules by typing:</p>

<pre><code>netsh advfirewall firewall show rule name=all
</code></pre>

<p>That command will display quite a bit of information. I like to output it to a text file and view it with notepad.</p>

<p>Now, let&#8217;s make some changes to allow remote connections to the server. Here, I don&#8217;t exactly follow the steps documented in Technet or most web sources since the commands documented will open up the ports and allow any source address. Here, we open Remote Desktop (TCP-3389) only to our subnet.</p>

<pre><code>netsh advfirewall firewall set rule name="Remote Desktop (TCP-In)" new remoteip=192.168.1.0/24
</code></pre>

<p>This changes the firewall RDP rule to allow our subnet only. The default rule is Any. Now, let&#8217;s go ahead and enable this rule:</p>

<pre><code>netsh advfirewall firewall set rule name="Remote Desktop (TCP-In)" new enable=yes
</code></pre>

<p>The firewall is now open for RDP connections from our internal subnet, but we still have to enable Remote Desktop:</p>

<pre><code>cscript %windir%\system32\SCRegEdit.wsf /ar 0
</code></pre>

<p>Now you could Remote Desktop to the server. Of course you will only get a command prompt when you do.</p>

<p>Next, we’ll open up some rules to allow remote management using the MMC. This will allow using Computer Management, Shared Folders, Event Viewer, and other important snap-ins to manage your server. The process is the same as it was opening the Remote Desktop rule, but the rule names are different:</p>

<pre><code>netsh advfirewall firewall set rule name="Remote Administration (NP-In)" new remoteip=192.168.1.0/24
netsh advfirewall firewall set rule name="Remote Administration (NP-In)" new enable=yes
netsh advfirewall firewall set rule name="Remote Administration (RPC)" new remoteip=192.168.1.0/24
netsh advfirewall firewall set rule name="Remote Administration (RPC)" new enable=yes
netsh advfirewall firewall set rule name="Remote Administration (RPC-EPMAP)" new remoteip=192.168.1.0/24
netsh advfirewall firewall set rule name="Remote Administration (RPC-EPMAP)" new enable=yes
</code></pre>

<p>These three rules are in a group called “Remote Administration” and if you are not concerned about modifying the rules so that only the specific subnet is allowed, you can modify enable the group as-is which will allow connections from any IP:</p>

<pre><code>netsh advfirewall firewall set rule group="Remote Administration" new enable=yes
</code></pre>

<p><strong>
<span style="text-decoration: underline;">CONFIGURING ROLES</span></strong></p>

<p>There are two commands to use when dealing with server roles: <strong>oclist</strong> and <strong>ocsetup</strong>. Later, we will look at the new <strong>dism.exe</strong> If you type oclist, you will get a list of all the roles and their optional components. The list is pretty lengthy, so I like to use the <strong>find</strong> command to narrow my results. For example, if we wanted to add the DHCP server role, I would check for the precise name of the role by typing:</p>

<pre><code>oclist | find /i "dhcp"
</code></pre>

<p>Results:</p>

<pre><code>Not Installed: DHCPServerCore
</code></pre>

<p>Now I know the role name is specifically DHCPServerCore and that it is in fact not installed. So, we install the role by typing:</p>

<pre><code>ocsetup DHCPServerCore
</code></pre>

<p>Note that the above server role IS case sensitive. If I use oclist again to check for DHCP, I now see the following:</p>

<pre><code>oclist | find /i "dhcp"
</code></pre>

<p>Results:</p>

<pre><code>Installed: DHCPServerCore
</code></pre>

<p>If I wanted to remove the role, I&#8217;d use the uninstall switch with ocsetup:</p>

<pre><code>ocsetup DHCPServerCore /uninstall
</code></pre>

<p>Pretty straight forward. Now, with R2, there is a new CLI tool called <strong>dism.exe</strong>. This tool can also configure server roles, but it does much more. For now, we will use it to configure roles like we did with ocsetup/oclist.</p>

<p>To get a list of roles (called features in dism):</p>

<pre><code>dism /online /get-features
</code></pre>

<p>Let&#8217;s add that DHCPServerCore feature using dism:</p>

<pre><code>dism /online /enable-feature /featurename:DHCPServerCore
</code></pre>

<p>And then to remove it:</p>

<pre><code>dism /online /disable-feature /featurename:DHCPServerCore
</code></pre>

<p>So, what is the big deal? Same results as ocsetup, but, dism will replace it because it goes further than just toggling features. It will service WIM and VHD image files, allowing add/remove of drivers and features, especially useful if your server has the role of deploying images or runs Hyper-V.</p>

<p><strong><span style="text-decoration: underline;">PROMOTING TO A DC</span></strong></p>

<p><code>dcpromo</code> is still the way to handle promoting and demoting domain controllers, but in a Server Core installation, there is no GUI wizard that comes along with it. Instead, you use an answer file with the command to instruct how to promote your DC. The syntax to this is:</p>

<pre><code>dcpromo /unattend:c:\temp\answerfile.ini
</code></pre>

<p>I like to use ini for my answer file extension, but that&#8217;s a personal preference. Here are two examples of answer files to us with dcpromo:</p>

<p>To create the very first DC in a Forest:
<pre><code>[DCInstall]
ReplicaOrNewDomain=Domain
Installdns=Yes
confirmgc=yes
domainlevel=4
domainnetbiosname=TESTDOM
forestlevel=4
newdomain=forest
newdomaindnsname=testdom.local
safemodeadminpassword=password123
</code></pre>
Note that the forest level and domain level are set to 4. This option is for R2 only as it is the R2 functional level. For 2008 non-R2, this value needs to be 3 instead.</p>

<p>To add a replica domain controller in an existing domain:
<pre><code>[DCInstall]
ReplicaOrNewDomain=Replica
ReplicaDomainDNSName=testdom.int
Installdns=Yes
confirmgc=yes
safemodeadminpassword=password123
</code></pre>
There are quite a few configurable options to put in an answer file. You can check the help by typing: <strong>dcpromo /?:promotion</strong></p>

<p><strong><span style="text-decoration: underline;">MORE IN THE CLI</span></strong></p>

<p>Now you have a fully functioning server, are able to manage it with your MMC, and can connect via Remote Desktop. Although there are hundreds of commands you can use in the CLI, one that can do an enormous amount of tasks is <strong>wmic.exe</strong>. WMIC<strong> </strong>is a tool with hundreds of options for WMI. You can do just about anything here. A few examples:</p>

<pre><code>wmic useraccount list
wmic process list
wmic share list
</code></pre>

<p>The above examples are all very simple queries for information. You can also use wmic to add and modify (ie. not just list shares, but create or change them). To see a full list of options: <strong>wmic /?</strong></p>

<p><strong></p>

<p></strong></p>

<p><span style="text-decoration: underline;"><strong>POWERSHELL</strong></span></p>

<p>Powershell is now included with R2 and you can enable it just like any other feature. Powershell provides a shell and scripting language which will open up a world of options for administrating your Windows environment. What gives this shell its power is that it accepts and returns .NET objects. Instead of getting stdout, you can get an object and then perform actions with that object or get its properties. With a couple of lines of script code, you can pull all users from an OU and set their description field, or check when the passwords were last set. That is just one simple example working with objects using the DirectoryServices interface, and there are many others.</p>

<p><span style="text-decoration: underline;"><strong>CONCLUSION</strong></span></p>

<p>It is nice to see that the command line has made a return in the Windows world. If you’re unlike me, who typically has five or six command prompts open during a regular day, don’t be intimidated by it. Server Core can be a lean, secure, and well-managed option in your environment. It may take a little time getting used to not reaching for the mouse and clicking on the start button, but at the end of the day you will have that extra bit of satisfaction knowing exactly what occurred without a GUI keeping the details behind the scenes.</p>

<hr />

<p>References:</p>

<ul>
<li>Real Men Don&#8217;t Click&#8211;The Project: <a href="http://isg.ee.ethz.ch/tools/realmen/">http://isg.ee.ethz.ch/tools/realmen/</a></li>
<li>Server Core Installation: <a href="http://technet.microsoft.com/en-us/library/cc753802(WS.10).aspx">http://technet.microsoft.com/en-us/library/cc753802(WS.10).aspx</a></li>
<li>Using DISM: <a href="http://www.windowsnetworking.com/articles_tutorials/Deploying-Windows-7-Part2.html">http://www.windowsnetworking.com/articles_tutorials/Deploying-Windows-7-Part2.html</a></li>
<li>DISM Command Line Options: <a href="http://technet.microsoft.com/en-us/library/dd772580(WS.10).aspx">http://technet.microsoft.com/en-us/library/dd772580(WS.10).aspx</a></li>
<li>WMIC: <a href="http://technet.microsoft.com/en-us/library/bb742610.aspx">http://technet.microsoft.com/en-us/library/bb742610.aspx</a></li>
<li>Powershell: <a href="http://www.microsoft.com/windowsserver2003/technologies/management/powershell/default.mspx">http://www.microsoft.com/windowsserver2003/technologies/management/powershell/default.mspx</a></li>
<li>Windows 2008 Command Line List (A-Z): <a href=http://technet.microsoft.com/en-us/library/cc772390(WS.10).aspx>http://technet.microsoft.com/en-us/library/cc772390(WS.10).aspx</a>
</span></li>
</ul>

<p><strong>Related Posts:</strong></p>
<ul>
<li><a href="http://praetorianprefect.com/archives/2010/06/iphone-4-ordering-and-session-switching/">iPhone 4 Ordering and Session Switching</a></li>
<li><a href="http://praetorianprefect.com/archives/2010/05/mays-patch-tuesday/">May&#8217;s Patch Tuesday</a></li>
<li><a href="http://praetorianprefect.com/archives/2010/03/3473/">March&#8217;s Patch Tuesday</a></li>
<li><a href="http://praetorianprefect.com/archives/2010/03/press-f1-for-help-pwned/">Press F1 for Help, pwned.</a></li>
<li><a href="http://praetorianprefect.com/archives/2010/01/the-aurora-ie-exploit-in-action/">The &#8220;Aurora&#8221; IE Exploit Used Against Google in Action</a></li>
</ul><br />
]]></content:encoded>
			<wfw:commentRss>http://praetorianprefect.com/archives/2009/09/2008-server-to-the-core/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Who’s Being Promiscuous in Your Active Directory?</title>
		<link>http://praetorianprefect.com/archives/2009/09/whos-being-promiscuous-in-your-active-directory/</link>
		<comments>http://praetorianprefect.com/archives/2009/09/whos-being-promiscuous-in-your-active-directory/#comments</comments>
		<pubDate>Tue, 15 Sep 2009 00:18:50 +0000</pubDate>
		<dc:creator>Simon Price</dc:creator>
				<category><![CDATA[Administration]]></category>
		<category><![CDATA[Networking]]></category>
		<category><![CDATA[Security]]></category>
		<category><![CDATA[Tools]]></category>
		<category><![CDATA[active directory]]></category>
		<category><![CDATA[Microsoft]]></category>
		<category><![CDATA[powershell]]></category>
		<category><![CDATA[windows]]></category>
		<category><![CDATA[WMI]]></category>

		<guid isPermaLink="false">http://praetorianprefect.com/?p=719</guid>
		<description><![CDATA[I’m always a fan of more queries and peaks at what is going on in my AD domain, especially at what is happening on the workstations. I was working on some WMI queries to get information about network interfaces using the Win32_NetworkAdapterConfiguration class, and thought about promqry.exe. Promqry is a tool provided by Microsoft to [...]]]></description>
			<content:encoded><![CDATA[<p>I’m always a fan of more queries and peaks at what is going on in my AD domain, especially at what is happening on the workstations. I was working on some WMI queries to get information about network interfaces using the Win32_NetworkAdapterConfiguration class, and thought about promqry.exe. <a href="http://support.microsoft.com/kb/892853" target="_blank">Promqry</a> is a tool provided by Microsoft to query a computer’s network interfaces and return if it is running in promiscuous mode.</p>

<p>This information can be handy for several reasons:</p>

<ul>
    <li>An interface running in promiscuous mode may be due to the user running network sniffer such as Wireshark.</li>
    <li>An interface running in promiscuous mode may be due to the user running virtualization software, such as Virtual PC.</li>
    <li>An interface running in promiscuous mode may be due to malicious code.</li>
</ul>

<p>I definitely want to know if users are running network sniffers, or virtualization software (likely the guests are not licensed or managed causing rogue workstations in the environment). Of course any potential activity that may be caused by malware or malicious code is a concern as well.</p>

<p>You could very easily download promqry and run a <em>for</em> loop against your machines. I wanted to use WMI for this task instead and rather than a text file, use the directoryservices object to query my AD for computers.</p>

<p>I couldn’t find any property in Win32_NetworkAdapterConfiguration to check for this, but I found <a href="http://windowsir.blogspot.com/2005/02/promqry-revisited.html" target="_blank">this post</a> on promqry which tracked down the WMI classes it uses. That led me in the right direction. The other key to this is what MSNdis_CurrentPacketFilter returns. Microsoft documents this <a href="http://msdn.microsoft.com/en-us/library/bb648512.aspx" target="_blank">here</a> and we are checking if the NDIS_PACKET_TYPE_PROMISCUOUS bit is enabled.</p>

<p>Below is a quick Powershell script which will grab computer objects from AD, then use WMI and the MSNdis_CurrentPacketFilter class to check for promiscuous mode. You can incorporate this WMI query with Win32_NetworkAdapterConfiguration and get a better picture of the interface network settings:
<pre><code>
$ErrorActionPreference = "SilentlyContinue"</p>

<p>$PingTest = New-Object System.Net.NetworkInformation.Ping
$Filter = "(&amp;(ObjectCategory=computer))"
$Searcher = New-Object System.DirectoryServices.DirectorySearcher($Filter)
ForEach ($comp in $Searcher.Findall()) {
    $strComputer = $comp.properties.item("Name")
    write-host "Checking: $strComputer"
    if ($PingTest.Send($strComputer).Status -eq "Success") {
        $colComputer = get-wmiObject -class "MSNdis_CurrentPacketFilter" -namespace "root\WMI" -comp $strComputer
        if ($colComputer -eq $null) {
            write-host "Couldn't connect to WMI" }
        else {
            foreach ($comp in $colcomputer) {
                $val = $comp.NdisCurrentPacketFilter
                if ($val -band 0x00000020) {
                    $inst = $comp.InstanceName
                    write-host "Interface: $inst"
                    write-host "The NDIS_PACKET_TYPE_PROMISCUOUS value is set" -foregroundcolor red -backgroundcolor yellow
                }
            }
        }
    }
    else { write-host "Could not ping, machine not queried." }
}</p>

<p></code></pre>
 </p>

<p>The following screenshot shows the results. I don’t like waiting for RPC to time out when the machine is off or not reachable, so a quick ping check before querying WMI speeds things up. Also, when an interface has the bit set, the output is highlighted with red text and a yellow foreground. You could wrap an email function and schedule this so that you are alerted when it comes up.</p>

<p><a href="http://praetorianprefect.com/wp-content/uploads/2009/10/ScreenHunter_06Oct.0120.51.gif"><img style="border-bottom: 0px; border-left: 0px; display: inline; border-top: 0px; border-right: 0px" title="ScreenHunter_06 Oct. 01 20.51" src="http://praetorianprefect.com/wp-content/uploads/2009/10/ScreenHunter_06Oct.0120.51_thumb.gif" border="0" alt="ScreenHunter_06 Oct. 01 20.51" width="244" height="173" /></a></p>

<p> </p>

<p> </p>

<p> </p>

<p> </p>

<p> </p>

<p> </p>

<p>You will need proper access to the workstations to query root\WMI so when you run this in a domain, your account should have local administrator privileges to the computers it will query. If it doesn’t, the command will return “Couldn’t connect to WMI”.</p>

<p>Finally, if you haven’t looked at the MSNdis class yet, I suggest taking a look, especially at MSNdis_80211 which will query various wireless information that may be of interest. There isn’t a whole lot of documentation on it, so I’ll work on getting some details together and maybe draft a Powershell script to find wireless adapters and networks they are connected to or available networks close enough to connect to. Until then, enjoy finding those promiscuous mode adapters in your domain.</p>

<p> </p>

<p><a title="http://windowsir.blogspot.com/2005/02/promqry-revisited.html" href="http://windowsir.blogspot.com/2005/02/promqry-revisited.html"> </a></p>

<p><strong>Related Posts:</strong></p>
<ul>
<li><a href="http://praetorianprefect.com/archives/2010/06/iphone-4-ordering-and-session-switching/">iPhone 4 Ordering and Session Switching</a></li>
<li><a href="http://praetorianprefect.com/archives/2010/05/mays-patch-tuesday/">May&#8217;s Patch Tuesday</a></li>
<li><a href="http://praetorianprefect.com/archives/2010/03/3473/">March&#8217;s Patch Tuesday</a></li>
<li><a href="http://praetorianprefect.com/archives/2010/03/press-f1-for-help-pwned/">Press F1 for Help, pwned.</a></li>
<li><a href="http://praetorianprefect.com/archives/2010/01/first-patch-tuesday-of-2010/">First Patch Tuesday of 2010</a></li>
</ul><br />
]]></content:encoded>
			<wfw:commentRss>http://praetorianprefect.com/archives/2009/09/whos-being-promiscuous-in-your-active-directory/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
	</channel>
</rss>
