<?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>Active Directory | KC's Blog</title>
	<atom:link href="https://www.kjctech.net/tag/active-directory/feed/" rel="self" type="application/rss+xml" />
	<link>https://www.kjctech.net</link>
	<description></description>
	<lastBuildDate>Sat, 16 Mar 2024 06:47:14 +0000</lastBuildDate>
	<language>en-US</language>
	<sy:updatePeriod>
	hourly	</sy:updatePeriod>
	<sy:updateFrequency>
	1	</sy:updateFrequency>
	

<image>
	<url>https://i0.wp.com/www.kjctech.net/wp-content/uploads/2016/12/cropped-KC-Logo.png?fit=32%2C32&#038;ssl=1</url>
	<title>Active Directory | KC's Blog</title>
	<link>https://www.kjctech.net</link>
	<width>32</width>
	<height>32</height>
</image> 
<site xmlns="com-wordpress:feed-additions:1">24634607</site>	<item>
		<title>In-Place Upgrading A Windows Server 2012 Domain Controller to Windows Server 2019 or 2022</title>
		<link>https://www.kjctech.net/in-place-upgrading-a-windows-server-2012-domain-controller-to-windows-server-2019-or-2022/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=in-place-upgrading-a-windows-server-2012-domain-controller-to-windows-server-2019-or-2022</link>
					<comments>https://www.kjctech.net/in-place-upgrading-a-windows-server-2012-domain-controller-to-windows-server-2019-or-2022/#comments</comments>
		
		<dc:creator><![CDATA[Kent Chen]]></dc:creator>
		<pubDate>Sat, 16 Mar 2024 06:47:11 +0000</pubDate>
				<category><![CDATA[Microsoft]]></category>
		<category><![CDATA[Active Directory]]></category>
		<category><![CDATA[Azure Active Directory]]></category>
		<guid isPermaLink="false">https://www.kjctech.net/?p=5146</guid>

					<description><![CDATA[<p>Generally speaking, in-place upgrading from one server version to another usually goes almost perfectly, given that the upgrade path is supported. You can just mount an ISO image and go with it. But when the server you are upgrading is a domain controller. There are other things to consider before going ahead. Pre-upgrade First, if you have Azure (Entra) AD [&#8230;]</p>
The post <a href="https://www.kjctech.net/in-place-upgrading-a-windows-server-2012-domain-controller-to-windows-server-2019-or-2022/">In-Place Upgrading A Windows Server 2012 Domain Controller to Windows Server 2019 or 2022</a> first appeared on <a href="https://www.kjctech.net">KC's Blog</a>.]]></description>
										<content:encoded><![CDATA[<p>Generally speaking, in-place upgrading from one server version to another usually goes almost perfectly, given that the upgrade path is supported. You can just mount an ISO image and go with it. But when the server you are upgrading is a domain controller. There are other things to consider before going ahead.</p>



<h3 class="wp-block-heading">Pre-upgrade</h3>



<p>First, if you have Azure (Entra) AD Connect installed on the server, an in-place upgrade will mess things up quite badly. <a href="https://learn.microsoft.com/en-us/entra/identity/hybrid/connect/how-to-upgrade-previous-version" target="_blank" rel="noopener" title="">What Microsoft suggests</a> is to use the Swing migration to set the original server in stage mode and temporarily move the Azure (Entra) AD Connect to a different server.</p>



<p>You will also need to prepare the AD schema before the in-place upgrade. Mount the Windows Server 2019 or 2022 Installation ISO media, go to the <strong><em>support\adprep</em></strong> folder and run the following commands.</p>



<pre class="wp-block-preformatted">adprep /forestprep
adprep /domainprep</pre>



<p>Once done, run the following PowerShell cmdlet to confirm the result about the schema version you are about to upgrade to.</p>



<pre class="wp-block-preformatted">Get-ADObject (Get-ADRootDSE).schemaNamingContext -Property objectVersion</pre>



<p>Here is the schema version value table for your reference.</p>



<pre class="wp-block-preformatted">Windows Server 2012 R2 - 69
Windows Server 2016 - 87
Windows Server 2019 - 88
Windows Server 2022 - 88</pre>



<h3 class="wp-block-heading">The actual upgrade</h3>



<p>Now, it is good to go with the in-place upgrade. The actual process will be quite straightforward and should be done fairly quickly.</p>



<h3 class="wp-block-heading">Post-upgrade</h3>



<p>Everything should be up and running right away, including DNS, AD services as well as group policy setups. Two things might require your attention.</p>



<p>The DHCP server might need to be re-authorized to be used again.</p>



<p>Also, if you are using the SMTP services from the legacy IIS 6, you might need to re-configure everything. The settings were wiped out during one of my upgrades. It&#8217;s a good idea to document the setup before doing the upgrade.</p>



<h4 class="wp-block-heading">References:</h4>



<ul class="wp-block-list">
<li><a href="https://learn.microsoft.com/en-us/entra/identity/hybrid/connect/how-to-upgrade-previous-version" target="_blank" rel="noopener" title="">Microsoft Entra Connect: Upgrade from a previous version to the latest</a></li>



<li><a href="https://learn.microsoft.com/en-us/windows-server/identity/ad-ds/deploy/upgrade-domain-controllers" target="_blank" rel="noopener" title="">Upgrade domain controllers to a newer version of Windows Server</a></li>
</ul>The post <a href="https://www.kjctech.net/in-place-upgrading-a-windows-server-2012-domain-controller-to-windows-server-2019-or-2022/">In-Place Upgrading A Windows Server 2012 Domain Controller to Windows Server 2019 or 2022</a> first appeared on <a href="https://www.kjctech.net">KC's Blog</a>.]]></content:encoded>
					
					<wfw:commentRss>https://www.kjctech.net/in-place-upgrading-a-windows-server-2012-domain-controller-to-windows-server-2019-or-2022/feed/</wfw:commentRss>
			<slash:comments>1</slash:comments>
		
		
		<post-id xmlns="com-wordpress:feed-additions:1">5146</post-id>	</item>
		<item>
		<title>Retrieving Logon/Logoff Activities from A Remote Domain-Joined Computer</title>
		<link>https://www.kjctech.net/retrieving-logon-logoff-activities-from-a-remote-domain-joined-computer/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=retrieving-logon-logoff-activities-from-a-remote-domain-joined-computer</link>
					<comments>https://www.kjctech.net/retrieving-logon-logoff-activities-from-a-remote-domain-joined-computer/#respond</comments>
		
		<dc:creator><![CDATA[Kent Chen]]></dc:creator>
		<pubDate>Tue, 23 May 2023 05:44:49 +0000</pubDate>
				<category><![CDATA[Microsoft]]></category>
		<category><![CDATA[Active Directory]]></category>
		<category><![CDATA[powershell]]></category>
		<guid isPermaLink="false">https://www.kjctech.net/?p=5071</guid>

					<description><![CDATA[<p>If you are in an AD environment, checking out the logon activities on certain users can be done through the Security log on the domain controller. However, reading through these log entries can be time-consuming. The workaround is to retrieve the logon activities right from the desktop computer if you know which computer to look to. It&#8217;s actually way easier. [&#8230;]</p>
The post <a href="https://www.kjctech.net/retrieving-logon-logoff-activities-from-a-remote-domain-joined-computer/">Retrieving Logon/Logoff Activities from A Remote Domain-Joined Computer</a> first appeared on <a href="https://www.kjctech.net">KC's Blog</a>.]]></description>
										<content:encoded><![CDATA[<p>If you are in an AD environment, checking out the logon activities on certain users can be done through the Security log on the domain controller. However, reading through these log entries can be time-consuming. The workaround is to retrieve the logon activities right from the desktop computer if you know which computer to look to.</p>



<p>It&#8217;s actually way easier. To retrieve the logon activities from a remote computer for the past 7 days, all you need is to run this.</p>



<pre class="wp-block-preformatted">Get-EventLog System -Source Microsoft-Windows-WinLogon -After (Get-Date).AddDays(-7) -ComputerName $computer</pre>



<p>However, in order to pull the event log from a remote computer, the Remote Registry service needs to be running on that computer. It&#8217;s disabled by default for security reasons.</p>



<p>You will need to reenable the service and start it before pulling the log entries.</p>



<pre class="wp-block-code"><code lang="powershell" class="language-powershell">Invoke-Command -ComputerName $computer -ScriptBlock {
    $service = 'RemoteRegistry'
    Set-Service -Name $service -StartupType Manual
    Start-Service -Name $service
}</code></pre>



<p>Once done, you will need to stop and disable it too.</p>



<pre class="wp-block-code"><code lang="powershell" class="language-powershell">Invoke-Command -ComputerName $computer -ScriptBlock {
    $service = 'RemoteRegistry'
    Stop-Service -Name $service
    Set-Service -Name $service -StartupType Disabled
}</code></pre>



<p>So, putting everything all together,</p>



<pre class="wp-block-code"><code lang="powershell" class="language-powershell">$computer = Read-Host "Coomputer Name:"
Invoke-Command -ComputerName $computer -ScriptBlock {
    $service = 'RemoteRegistry'
    Set-Service -Name $service -StartupType Manual
    Start-Service -Name $service
}
$logs = Get-EventLog System -Source Microsoft-Windows-WinLogon -After (Get-Date).AddDays(-7) -ComputerName $computer
ForEach ($log in $logs){
    $user = Get-ADUser -Filter * | Where-Object {$_.SID -eq $log.ReplacementStrings[1]}
    $log.TimeGenerated.ToString() + ' - ' + $user.Name + ' - ' + $log.Message
}
Invoke-Command -ComputerName $computer -ScriptBlock {
    $service = 'RemoteRegistry'
    Stop-Service -Name $service
    Set-Service -Name $service -StartupType Disabled
}</code></pre>



<p>Bonus point, I&#8217;ve formatted the output with a real username as well.</p>The post <a href="https://www.kjctech.net/retrieving-logon-logoff-activities-from-a-remote-domain-joined-computer/">Retrieving Logon/Logoff Activities from A Remote Domain-Joined Computer</a> first appeared on <a href="https://www.kjctech.net">KC's Blog</a>.]]></content:encoded>
					
					<wfw:commentRss>https://www.kjctech.net/retrieving-logon-logoff-activities-from-a-remote-domain-joined-computer/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
		<post-id xmlns="com-wordpress:feed-additions:1">5071</post-id>	</item>
		<item>
		<title>How To Use Active Directory&#8217;s Account Log On To Feature to Limit RDP Computer Access</title>
		<link>https://www.kjctech.net/how-to-use-active-directorys-account-log-on-to-feature-to-limit-rdp-computer-access/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=how-to-use-active-directorys-account-log-on-to-feature-to-limit-rdp-computer-access</link>
					<comments>https://www.kjctech.net/how-to-use-active-directorys-account-log-on-to-feature-to-limit-rdp-computer-access/#respond</comments>
		
		<dc:creator><![CDATA[Kent Chen]]></dc:creator>
		<pubDate>Wed, 13 Jul 2022 05:56:21 +0000</pubDate>
				<category><![CDATA[Microsoft]]></category>
		<category><![CDATA[Active Directory]]></category>
		<guid isPermaLink="false">https://www.kjctech.net/?p=4775</guid>

					<description><![CDATA[<p>I never used Active Directory&#8217;s Account Log On To feature to limit computer access for certain user accounts before. So when I had to do it the other day, I thought I can just simply put the computer name in the Log On To computer list for that user account and call it a day. Guess I was wrong. I [&#8230;]</p>
The post <a href="https://www.kjctech.net/how-to-use-active-directorys-account-log-on-to-feature-to-limit-rdp-computer-access/">How To Use Active Directory’s Account Log On To Feature to Limit RDP Computer Access</a> first appeared on <a href="https://www.kjctech.net">KC's Blog</a>.]]></description>
										<content:encoded><![CDATA[<p>I never used Active Directory&#8217;s Account Log On To feature to limit computer access for certain user accounts before. So when I had to do it the other day, I thought I can just simply put the computer name in the <strong>Log On To</strong> computer list for that user account and call it a day.</p>



<figure class="wp-block-image size-full"><img data-recalc-dims="1" fetchpriority="high" decoding="async" width="370" height="417" src="https://i0.wp.com/www.kjctech.net/wp-content/uploads/2022/07/image-3.png?resize=370%2C417&#038;ssl=1" alt="" class="wp-image-4776" srcset="https://i0.wp.com/www.kjctech.net/wp-content/uploads/2022/07/image-3.png?w=370&amp;ssl=1 370w, https://i0.wp.com/www.kjctech.net/wp-content/uploads/2022/07/image-3.png?resize=250%2C282&amp;ssl=1 250w, https://i0.wp.com/www.kjctech.net/wp-content/uploads/2022/07/image-3.png?resize=360%2C406&amp;ssl=1 360w, https://i0.wp.com/www.kjctech.net/wp-content/uploads/2022/07/image-3.png?resize=100%2C113&amp;ssl=1 100w" sizes="(max-width: 370px) 100vw, 370px" /></figure>



<p>Guess I was wrong. I kept getting this error message telling me that either the credential is wrong or something like below.</p>



<figure class="wp-block-image size-full"><img data-recalc-dims="1" decoding="async" width="558" height="148" src="https://i0.wp.com/www.kjctech.net/wp-content/uploads/2022/07/image-4.png?resize=558%2C148&#038;ssl=1" alt="" class="wp-image-4777" srcset="https://i0.wp.com/www.kjctech.net/wp-content/uploads/2022/07/image-4.png?w=558&amp;ssl=1 558w, https://i0.wp.com/www.kjctech.net/wp-content/uploads/2022/07/image-4.png?resize=450%2C119&amp;ssl=1 450w, https://i0.wp.com/www.kjctech.net/wp-content/uploads/2022/07/image-4.png?resize=250%2C66&amp;ssl=1 250w, https://i0.wp.com/www.kjctech.net/wp-content/uploads/2022/07/image-4.png?resize=520%2C138&amp;ssl=1 520w, https://i0.wp.com/www.kjctech.net/wp-content/uploads/2022/07/image-4.png?resize=360%2C95&amp;ssl=1 360w, https://i0.wp.com/www.kjctech.net/wp-content/uploads/2022/07/image-4.png?resize=100%2C27&amp;ssl=1 100w" sizes="(max-width: 558px) 100vw, 558px" /></figure>



<p>So, what went wrong?</p>



<p>The problem is more in the wording. While it says &#8220;Log On To&#8221; and &#8220;Logon Workstations&#8221;, it actually means the computers from both ends. For example, if User-A needs to RDP in Computer-B from Computer-A. Both Computer-A and Computer-B&#8217;s names need to be in the Logon Workstations list. Missing either one will result in not being able to remote in.</p>The post <a href="https://www.kjctech.net/how-to-use-active-directorys-account-log-on-to-feature-to-limit-rdp-computer-access/">How To Use Active Directory’s Account Log On To Feature to Limit RDP Computer Access</a> first appeared on <a href="https://www.kjctech.net">KC's Blog</a>.]]></content:encoded>
					
					<wfw:commentRss>https://www.kjctech.net/how-to-use-active-directorys-account-log-on-to-feature-to-limit-rdp-computer-access/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
		<post-id xmlns="com-wordpress:feed-additions:1">4775</post-id>	</item>
		<item>
		<title>Active Directory Tip: How To Batch Update Remote Desktop Services Profile Path Property</title>
		<link>https://www.kjctech.net/active-directory-tip-how-to-batch-update-remote-desktop-services-profile-path-property/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=active-directory-tip-how-to-batch-update-remote-desktop-services-profile-path-property</link>
					<comments>https://www.kjctech.net/active-directory-tip-how-to-batch-update-remote-desktop-services-profile-path-property/#respond</comments>
		
		<dc:creator><![CDATA[Kent Chen]]></dc:creator>
		<pubDate>Tue, 11 Jan 2022 07:01:21 +0000</pubDate>
				<category><![CDATA[Microsoft]]></category>
		<category><![CDATA[Active Directory]]></category>
		<category><![CDATA[powershell]]></category>
		<guid isPermaLink="false">https://www.kjctech.net/?p=4701</guid>

					<description><![CDATA[<p>It&#8217;s really easy if you need to make changes to the roaming profile path in Active Directory to multiple user accounts. All you need is to highlight them all, right-click and select Properties. But as you can see, it doesn&#8217;t have the Remote Desktop Service Profile tab. So how do you batch update this property to a large number of [&#8230;]</p>
The post <a href="https://www.kjctech.net/active-directory-tip-how-to-batch-update-remote-desktop-services-profile-path-property/">Active Directory Tip: How To Batch Update Remote Desktop Services Profile Path Property</a> first appeared on <a href="https://www.kjctech.net">KC's Blog</a>.]]></description>
										<content:encoded><![CDATA[<p>It&#8217;s really easy if you need to make changes to the roaming profile path in Active Directory to multiple user accounts. All you need is to highlight them all, right-click and select Properties. </p>



<figure class="wp-block-image size-full"><img decoding="async" width="400" height="455" src="//i0.wp.com/kjctech.net/wp-content/uploads/2022/01/image-1.png" alt="" class="wp-image-4703" srcset="https://i0.wp.com/www.kjctech.net/wp-content/uploads/2022/01/image-1.png?w=400&amp;ssl=1 400w, https://i0.wp.com/www.kjctech.net/wp-content/uploads/2022/01/image-1.png?resize=250%2C284&amp;ssl=1 250w, https://i0.wp.com/www.kjctech.net/wp-content/uploads/2022/01/image-1.png?resize=360%2C410&amp;ssl=1 360w, https://i0.wp.com/www.kjctech.net/wp-content/uploads/2022/01/image-1.png?resize=100%2C114&amp;ssl=1 100w" sizes="(max-width: 400px) 100vw, 400px" /></figure>



<p>But as you can see, it doesn&#8217;t have the Remote Desktop Service Profile tab. So how do you batch update this property to a large number of users when needed?</p>



<p>Here is a quick example of using PowerShell to find all users that belong to a specific OU and update them with the new network path for remote desktop service profiles.</p>



<pre class="wp-block-code"><code lang="powershell" class="language-powershell">$users = Get-ADuser -Filter * -SearchBase "OU=Test, DC=Test, DC=LOCAL"
$newpath = ''

ForEach ($user in $users){
    $userinfo = [ADSI]"LDAP://$($user.DistinguishedName)"
    $userinfo.psbase.invokeset('TerminalServicesProfilePath', $newpath)
    $userinfo.setinfo()
    $user.name + ' ' + $userinfo.TerminalServicesProfilePath
}</code></pre>



<p>Enjoy.</p>The post <a href="https://www.kjctech.net/active-directory-tip-how-to-batch-update-remote-desktop-services-profile-path-property/">Active Directory Tip: How To Batch Update Remote Desktop Services Profile Path Property</a> first appeared on <a href="https://www.kjctech.net">KC's Blog</a>.]]></content:encoded>
					
					<wfw:commentRss>https://www.kjctech.net/active-directory-tip-how-to-batch-update-remote-desktop-services-profile-path-property/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
		<post-id xmlns="com-wordpress:feed-additions:1">4701</post-id>	</item>
		<item>
		<title>How To Convert A Cloud Account to Azure AD Synced Account in Microsoft 365?</title>
		<link>https://www.kjctech.net/how-to-convert-a-cloud-account-to-azure-ad-synced-account-in-microsoft-365/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=how-to-convert-a-cloud-account-to-azure-ad-synced-account-in-microsoft-365</link>
					<comments>https://www.kjctech.net/how-to-convert-a-cloud-account-to-azure-ad-synced-account-in-microsoft-365/#comments</comments>
		
		<dc:creator><![CDATA[Kent Chen]]></dc:creator>
		<pubDate>Wed, 18 Nov 2020 01:21:33 +0000</pubDate>
				<category><![CDATA[Microsoft]]></category>
		<category><![CDATA[Active Directory]]></category>
		<category><![CDATA[Azure AD Connect]]></category>
		<category><![CDATA[Microsoft 365]]></category>
		<guid isPermaLink="false">https://www.kjctech.net/?p=4528</guid>

					<description><![CDATA[<p>If you already have accounts set up in Microsoft 365 tenant before you synchronized between on-premises Active Directory and Microsoft 365&#8217;s Azure AD, you may want to convert these accounts to the synced ones, rather than leaving them as the cloud users. Assume you already have your on-premises Active Directory cleaned up and prepared for Azure AD Connect, here are [&#8230;]</p>
The post <a href="https://www.kjctech.net/how-to-convert-a-cloud-account-to-azure-ad-synced-account-in-microsoft-365/">How To Convert A Cloud Account to Azure AD Synced Account in Microsoft 365?</a> first appeared on <a href="https://www.kjctech.net">KC's Blog</a>.]]></description>
										<content:encoded><![CDATA[<p>If you already have accounts set up in Microsoft 365 tenant before you synchronized between on-premises Active Directory and Microsoft 365&#8217;s Azure AD, you may want to convert these accounts to the synced ones, rather than leaving them as the cloud users.</p>



<p>Assume you already have your on-premises Active Directory cleaned up and prepared for Azure AD Connect, here are the steps that would make it happen.</p>



<p>First off, keep the accounts that you want to convert off the OU that will be synced up with Azure AD Connect. If you already have accounts duplicated in Microsoft 365, permanently delete these accounts first before moving forward.</p>



<p>Then, update the Cloud account&#8217;s UPN to match the one on on-premises AD.</p>



<p>Once done, run the following PowerShell cmdlets to match on-premises AD&#8217;s GUID with Cloud account&#8217;s Immutable ID. Making both IDs match tells Azure AD that the account is linked with on-premises Active Directory.</p>


<div class="wp-block-syntaxhighlighter-code "><pre class="brush: powershell; title: Code example:; notranslate">
Connect-MsolService
$upn = &quot;name@domain.com&quot;
$id = &#x5B;system.convert]::ToBase64String((Get-ADUser -filter {userprincipalname -eq $UPN}).objectGUid.ToByteArray())
Set-MsolUser -UserPrincipalName $upn -ImmutableId $id
</pre></div>


<p>Thanks to <a href="https://hybridcloudexperts.be/index.php/2017/11/03/changing-an-aad-office-365-cloud-user-to-a-synced-one/" target="_blank" rel="noreferrer noopener">here</a> for the ImuutableID trick.</p>



<p>If you encounter any cmdlet not found error, install and import the MSOnline module first from an elevated PowerShell window.</p>



<pre class="wp-block-preformatted">Install-Module MsOnline</pre>



<p>Finally, move these accounts back to the syncing OU and sync them all to Microsoft 365.</p>The post <a href="https://www.kjctech.net/how-to-convert-a-cloud-account-to-azure-ad-synced-account-in-microsoft-365/">How To Convert A Cloud Account to Azure AD Synced Account in Microsoft 365?</a> first appeared on <a href="https://www.kjctech.net">KC's Blog</a>.]]></content:encoded>
					
					<wfw:commentRss>https://www.kjctech.net/how-to-convert-a-cloud-account-to-azure-ad-synced-account-in-microsoft-365/feed/</wfw:commentRss>
			<slash:comments>1</slash:comments>
		
		
		<post-id xmlns="com-wordpress:feed-additions:1">4528</post-id>	</item>
		<item>
		<title>Setting Up Directory Sync Between On-Premises Active Directory with Microsoft 365 Azure AD</title>
		<link>https://www.kjctech.net/setting-up-directory-sync-between-on-premises-active-directory-with-microsoft-365-azure-ad/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=setting-up-directory-sync-between-on-premises-active-directory-with-microsoft-365-azure-ad</link>
					<comments>https://www.kjctech.net/setting-up-directory-sync-between-on-premises-active-directory-with-microsoft-365-azure-ad/#comments</comments>
		
		<dc:creator><![CDATA[Kent Chen]]></dc:creator>
		<pubDate>Tue, 17 Nov 2020 06:38:09 +0000</pubDate>
				<category><![CDATA[Microsoft]]></category>
		<category><![CDATA[Active Directory]]></category>
		<category><![CDATA[Azure AD Connect]]></category>
		<category><![CDATA[Microsoft 365]]></category>
		<guid isPermaLink="false">https://www.kjctech.net/?p=4522</guid>

					<description><![CDATA[<p>Microsoft 365 uses an Azure Active Directory to store and manage user credentials for authentication and permissions to access cloud-based resources. If you also have an on-premises Active Directory, you should sync them up for having central account management. The process of setting it up isn&#8217;t hard but it&#8217;s not easy and straightforward either. Here is a quick guide on [&#8230;]</p>
The post <a href="https://www.kjctech.net/setting-up-directory-sync-between-on-premises-active-directory-with-microsoft-365-azure-ad/">Setting Up Directory Sync Between On-Premises Active Directory with Microsoft 365 Azure AD</a> first appeared on <a href="https://www.kjctech.net">KC's Blog</a>.]]></description>
										<content:encoded><![CDATA[<p>Microsoft 365 uses an Azure Active Directory to store and manage user credentials for authentication and permissions to access cloud-based resources. If you also have an on-premises Active Directory, you should sync them up for having central account management.</p>



<p>The process of setting it up isn&#8217;t hard but it&#8217;s not easy and straightforward either. Here is a quick guide on how to make it happen.</p>



<h2 class="wp-block-heading">Local AD Preparation</h2>



<p>If your local domain has the same name as the one verified in Microsoft 365, preparation is easy. All you need to do is to make sure the UPN (UserPrincipalName) attribute matches the one you are planning to use in Microsoft 365.</p>



<p>However, if your local AD domain is a non-routable domain such as .local, you will need to add a second UPN suffix and update your users to it. The synced accounts with .local UPN will be automatically assigned the default onmicrosoft.com domain.</p>



<h3 class="wp-block-heading">To Add a new UPN suffix</h3>



<p>First, open Active Directory Domains and Trusts. Right-click Active Directory Domains and Trusts and choose Properties.</p>



<figure class="wp-block-image size-large"><img loading="lazy" decoding="async" width="529" height="311" src="//i0.wp.com/kjctech.net/wp-content/uploads/2020/11/image-2.png" alt="" class="wp-image-4523" srcset="https://i0.wp.com/www.kjctech.net/wp-content/uploads/2020/11/image-2.png?w=529&amp;ssl=1 529w, https://i0.wp.com/www.kjctech.net/wp-content/uploads/2020/11/image-2.png?resize=450%2C265&amp;ssl=1 450w, https://i0.wp.com/www.kjctech.net/wp-content/uploads/2020/11/image-2.png?resize=250%2C147&amp;ssl=1 250w, https://i0.wp.com/www.kjctech.net/wp-content/uploads/2020/11/image-2.png?resize=520%2C306&amp;ssl=1 520w, https://i0.wp.com/www.kjctech.net/wp-content/uploads/2020/11/image-2.png?resize=360%2C212&amp;ssl=1 360w, https://i0.wp.com/www.kjctech.net/wp-content/uploads/2020/11/image-2.png?resize=100%2C59&amp;ssl=1 100w" sizes="auto, (max-width: 529px) 100vw, 529px" /></figure>



<p>And add a new UPN suffix in the Properties window that pops up.</p>



<h3 class="wp-block-heading">To update UPN suffix for existing users</h3>



<p>You can update it in the Account tab in each user account&#8217;s properties window. But a much better way is to use PowerShell.</p>


<div class="wp-block-syntaxhighlighter-code "><pre class="brush: powershell; title: Code example:; notranslate">
$adusers = Get-ADUser - Filter * -SearchBase &quot;OU=OU Name, DC=domain, DC=local&quot; | Sort-Object Name
$adusers | ForEach {$_ | Set-ADUser -UserPrincipalName ($_.SamAccountName + &#039;@domain.com&#039;)}
</pre></div>


<h3 class="wp-block-heading">The IdFix tool</h3>



<p>There are other attributes in your AD that might need to be cleaned up, such as proxyAddresses, SAMAccountName, etc. The best way is to use a tool like <a href="https://microsoft.github.io/idfix/" target="_blank" rel="noreferrer noopener">IdFix</a> to identify and remediate the majority of directory synchronization errors.</p>



<p>You can download the tool in your Micrsoft 365 Directory Sync Status page and run it directly on your domain-joined Windows 10 computer.</p>



<h3 class="wp-block-heading">An Account for Azure AD Sync</h3>



<p>The Azure AD Connect tool will help set it up during the setup wizard but it&#8217;s easier to have it ready before you run the configuration wizard.</p>



<p>Create a regular domain account with a password that matches the AD&#8217;s password complicity policy. And you will have to grant the user the following two permissions. Or the password hash sync will fail.</p>



<ul class="wp-block-list">
<li>Replicating Directory Changes</li>



<li>Replicating Directory Changes All</li>
</ul>



<p>To do so, </p>



<ol class="wp-block-list">
<li>Open Active Directory Users and Computers</li>



<li>Go to View and select Advanced Features.</li>



<li>Right-click the main domain name and choose Properties.</li>



<li>In Security tab, add the account you want to use to directory sync and Allow the above two permissions.</li>
</ol>



<h2 class="wp-block-heading">Azure AD Connect</h2>



<p>Now, let&#8217;s download the <a href="https://www.microsoft.com/en-us/download/details.aspx?id=47594" target="_blank" rel="noreferrer noopener">Azure AD Connect</a>, install it on the Active Directory server, and <a href="https://docs.microsoft.com/en-us/azure/active-directory/hybrid/how-to-connect-install-custom" target="_blank" rel="noreferrer noopener">run the configuration wizard</a>. Follow up the wizard and it should be up and running shortly.</p>



<p>A few notes though that I hope would help.</p>



<p>You can sync the entire directory or the OUs of your choice.</p>



<figure class="wp-block-image size-large"><img loading="lazy" decoding="async" width="600" height="423" src="//i0.wp.com/kjctech.net/wp-content/uploads/2020/11/domainoufiltering-600x423.png" alt="" class="wp-image-4524" srcset="https://i0.wp.com/www.kjctech.net/wp-content/uploads/2020/11/domainoufiltering.png?resize=600%2C423&amp;ssl=1 600w, https://i0.wp.com/www.kjctech.net/wp-content/uploads/2020/11/domainoufiltering.png?resize=450%2C317&amp;ssl=1 450w, https://i0.wp.com/www.kjctech.net/wp-content/uploads/2020/11/domainoufiltering.png?resize=250%2C176&amp;ssl=1 250w, https://i0.wp.com/www.kjctech.net/wp-content/uploads/2020/11/domainoufiltering.png?resize=768%2C541&amp;ssl=1 768w, https://i0.wp.com/www.kjctech.net/wp-content/uploads/2020/11/domainoufiltering.png?resize=700%2C493&amp;ssl=1 700w, https://i0.wp.com/www.kjctech.net/wp-content/uploads/2020/11/domainoufiltering.png?resize=520%2C366&amp;ssl=1 520w, https://i0.wp.com/www.kjctech.net/wp-content/uploads/2020/11/domainoufiltering.png?resize=360%2C254&amp;ssl=1 360w, https://i0.wp.com/www.kjctech.net/wp-content/uploads/2020/11/domainoufiltering.png?resize=100%2C70&amp;ssl=1 100w, https://i0.wp.com/www.kjctech.net/wp-content/uploads/2020/11/domainoufiltering.png?w=880&amp;ssl=1 880w" sizes="auto, (max-width: 600px) 100vw, 600px" /></figure>



<p>There two ways you can stage your AD sync process. You can either enable the Stage mode in Azure AD Connect, or filter users via a specified group.</p>



<figure class="wp-block-image size-large"><img loading="lazy" decoding="async" width="600" height="424" src="//i0.wp.com/kjctech.net/wp-content/uploads/2020/11/filter2-600x424.png" alt="" class="wp-image-4525" srcset="https://i0.wp.com/www.kjctech.net/wp-content/uploads/2020/11/filter2.png?resize=600%2C424&amp;ssl=1 600w, https://i0.wp.com/www.kjctech.net/wp-content/uploads/2020/11/filter2.png?resize=450%2C318&amp;ssl=1 450w, https://i0.wp.com/www.kjctech.net/wp-content/uploads/2020/11/filter2.png?resize=250%2C177&amp;ssl=1 250w, https://i0.wp.com/www.kjctech.net/wp-content/uploads/2020/11/filter2.png?resize=768%2C543&amp;ssl=1 768w, https://i0.wp.com/www.kjctech.net/wp-content/uploads/2020/11/filter2.png?resize=700%2C494&amp;ssl=1 700w, https://i0.wp.com/www.kjctech.net/wp-content/uploads/2020/11/filter2.png?resize=520%2C367&amp;ssl=1 520w, https://i0.wp.com/www.kjctech.net/wp-content/uploads/2020/11/filter2.png?resize=360%2C254&amp;ssl=1 360w, https://i0.wp.com/www.kjctech.net/wp-content/uploads/2020/11/filter2.png?resize=100%2C71&amp;ssl=1 100w, https://i0.wp.com/www.kjctech.net/wp-content/uploads/2020/11/filter2.png?w=872&amp;ssl=1 872w" sizes="auto, (max-width: 600px) 100vw, 600px" /></figure>



<p>Note that if you use the Group filter option with the selected OUs, make sure the group resides inside that OU. Or, no accounts will be sync&#8217;d up.</p>



<p>To force a sync to start out of the scheduled window, run the following PowerShell cmdlet.</p>



<pre class="wp-block-preformatted">Start-ADSyncSyncCycle -PolicyType Delta</pre>



<p>To initiate a complete sync, </p>



<pre class="wp-block-preformatted">Start-ADSyncSyncCycle -PolicyType Initial</pre>



<p>If you are seeing an error telling you that the cmdlet is not recognized, run this.</p>



<pre class="wp-block-preformatted">Import-module ADSync</pre>



<h2 class="wp-block-heading">Resources</h2>



<ul class="wp-block-list">
<li><a href="https://docs.microsoft.com/en-us/microsoft-365/enterprise/microsoft-365-integration?view=o365-worldwide" target="_blank" rel="noreferrer noopener">Microsoft 365 integration with on-premises environments</a></li>



<li><a href="https://docs.microsoft.com/en-us/microsoft-365/enterprise/set-up-directory-synchronization?view=o365-worldwide" target="_blank" rel="noreferrer noopener">Set up directory synchronization for Microsoft 365</a></li>



<li><a href="https://docs.microsoft.com/en-us/microsoft-365/enterprise/prepare-for-directory-synchronization?view=o365-worldwide" target="_blank" rel="noreferrer noopener">Prepare for directory synchronization to Microsoft 365</a></li>



<li><a href="https://docs.microsoft.com/en-us/microsoft-365/enterprise/prepare-a-non-routable-domain-for-directory-synchronization?view=o365-worldwide" target="_blank" rel="noreferrer noopener">Prepare a non-routable domain for directory synchronization</a></li>



<li><a href="https://docs.microsoft.com/en-us/azure/active-directory/hybrid/how-to-connect-sync-whatis" target="_blank" rel="noreferrer noopener">Azure AD Connect Sync: understand and customize synchronization</a></li>
</ul>The post <a href="https://www.kjctech.net/setting-up-directory-sync-between-on-premises-active-directory-with-microsoft-365-azure-ad/">Setting Up Directory Sync Between On-Premises Active Directory with Microsoft 365 Azure AD</a> first appeared on <a href="https://www.kjctech.net">KC's Blog</a>.]]></content:encoded>
					
					<wfw:commentRss>https://www.kjctech.net/setting-up-directory-sync-between-on-premises-active-directory-with-microsoft-365-azure-ad/feed/</wfw:commentRss>
			<slash:comments>1</slash:comments>
		
		
		<post-id xmlns="com-wordpress:feed-additions:1">4522</post-id>	</item>
		<item>
		<title>Importing/Exporting Photos to/from Active Directory</title>
		<link>https://www.kjctech.net/importing-exporting-photos-to-from-active-directory/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=importing-exporting-photos-to-from-active-directory</link>
					<comments>https://www.kjctech.net/importing-exporting-photos-to-from-active-directory/#comments</comments>
		
		<dc:creator><![CDATA[Kent Chen]]></dc:creator>
		<pubDate>Mon, 07 Oct 2019 23:01:08 +0000</pubDate>
				<category><![CDATA[Microsoft]]></category>
		<category><![CDATA[Active Directory]]></category>
		<category><![CDATA[powershell]]></category>
		<guid isPermaLink="false">https://www.kjctech.net/?p=4416</guid>

					<description><![CDATA[<p>There are free tools like CodeTwo Active Directory Photos that lets you upload photos to Active Directory and manage them with a GUI interface. But it&#8217;s not as sleek and flexible as using a scripting tool like PowerShell. In order to use PowerShell to communicate with Active Directory, you will need the Active Directory module installed for PowerShell. The easiest [&#8230;]</p>
The post <a href="https://www.kjctech.net/importing-exporting-photos-to-from-active-directory/">Importing/Exporting Photos to/from Active Directory</a> first appeared on <a href="https://www.kjctech.net">KC's Blog</a>.]]></description>
										<content:encoded><![CDATA[<p>There are free tools like <a rel="noreferrer noopener" aria-label="CodeTwo Active Directory Photos (opens in a new tab)" href="https://www.codetwo.com/freeware/active-directory-photos/" target="_blank">CodeTwo Active Directory Photos</a> that lets you upload photos to Active Directory and manage them with a GUI interface. But it&#8217;s not as sleek and flexible as using a scripting tool like PowerShell.</p>



<p>In order to use PowerShell to communicate with Active Directory, you will need the Active Directory module installed for PowerShell. The easiest way is to install <a rel="noreferrer noopener" aria-label="RAST (opens in a new tab)" href="https://docs.microsoft.com/en-us/windows-server/remote/remote-server-administration-tools" target="_blank">RAST</a> (Remote Server Administration Tools)  on your Windows 10 computer.</p>



<h2 class="wp-block-heading">Import photos to Active Directory</h2>



<p>To save a photo for a specific user, <strong>Get-Content</strong> of the picture in a sequence of bytes and then use <strong>Set-ADUser</strong> to replace the ThumbnailPhoto property. </p>



<pre class="wp-block-code"><code lang="powershell" class="language-powershell">$photo = [byte[]](Get-Content $photopath -Encoding byte)
Set-ADUser $username -Replace @{thumbnailPhoto=$photo}</code></pre>



<p>You can name all the photos to match usernames in Active Directory&#8217;s and use the combination of <strong>Get-ADUser</strong> and <strong>Set-ADUser</strong> to import a bunch of photos at once.</p>



<pre class="wp-block-code"><code lang="powershell" class="language-powershell">$users = Get-AdUser -Filter * -SearchBase "OU=users, DC=domain, DC=local" -properties thumbnailphoto
foreach ($user in $users) {
    $photopath = "path\" + $user.samaccountname + '.jpg'
    $photo = [byte[]](Get-Content $photopath -Encoding byte)
    Set-ADUser $user -Replace @{thumbnailPhoto=$photo}
}</code></pre>



<h2 class="wp-block-heading">Export photos from Active Directory</h2>



<p>To export the photo from a specific user, use <strong>Get-ADDUser</strong> to locate the user with a particular property named <strong>ThumbnailPhoto</strong>. Then extract the ThumbnailPhoto property and encode it to a sequence of bytes.</p>



<pre class="wp-block-code"><code lang="powershell" class="language-powershell">$user = Get-ADUser $username -Properties thumbnailPhoto
$user.thumbnailPhoto | Set-Content $photopath -Encoding byte</code></pre>



<p>To export all photos attached to all users from a specific OU, you can do something similar like below:</p>



<pre class="wp-block-code"><code lang="powershell" class="language-powershell">$users = Get-AdUser -Filter * -SearchBase "OU=User, DC=domain, DC=local" -properties thumbnailphoto
foreach ($user in $users) {
    $photo = "\\sharepoint\c$\inetpub\wwwroot\cisco\" + $user.samaccountname + '.jpg'
    $user.thumbnailphoto | set-content $photo -encoding byte
}</code></pre>



<p>And that&#8217;s about it. It works like a charm in my case. Enjoy.</p>The post <a href="https://www.kjctech.net/importing-exporting-photos-to-from-active-directory/">Importing/Exporting Photos to/from Active Directory</a> first appeared on <a href="https://www.kjctech.net">KC's Blog</a>.]]></content:encoded>
					
					<wfw:commentRss>https://www.kjctech.net/importing-exporting-photos-to-from-active-directory/feed/</wfw:commentRss>
			<slash:comments>2</slash:comments>
		
		
		<post-id xmlns="com-wordpress:feed-additions:1">4416</post-id>	</item>
		<item>
		<title>Syncing Time within An Active Directory Domain Checklist</title>
		<link>https://www.kjctech.net/syncing-time-within-an-active-directory-domain-checklist/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=syncing-time-within-an-active-directory-domain-checklist</link>
					<comments>https://www.kjctech.net/syncing-time-within-an-active-directory-domain-checklist/#respond</comments>
		
		<dc:creator><![CDATA[Kent Chen]]></dc:creator>
		<pubDate>Mon, 24 Jun 2019 23:37:10 +0000</pubDate>
				<category><![CDATA[Microsoft]]></category>
		<category><![CDATA[Active Directory]]></category>
		<category><![CDATA[NTP]]></category>
		<category><![CDATA[w32tm]]></category>
		<category><![CDATA[Windows]]></category>
		<guid isPermaLink="false">https://www.kjctech.net/?p=4368</guid>

					<description><![CDATA[<p>A computer that had 30 seconds ahead of the domain controller got me to do this sanity check to see if the time is synchronized across the whole network. Why? Because having time off all over the place will cause all sorts of weird issues. It&#8217;s just that important. Here is a checklist of things you need to know when [&#8230;]</p>
The post <a href="https://www.kjctech.net/syncing-time-within-an-active-directory-domain-checklist/">Syncing Time within An Active Directory Domain Checklist</a> first appeared on <a href="https://www.kjctech.net">KC's Blog</a>.]]></description>
										<content:encoded><![CDATA[<p>A computer that had 30 seconds ahead of the domain controller got me to do this sanity check to see if the time is synchronized across the whole network. Why? Because having time off all over the place will cause all sorts of weird issues. It&#8217;s just that important.</p>



<p>Here is a checklist of things you need to know when it comes to syncing time in a Windows domain based network.</p>



<p>Firs of all, where to check to know what the exact time is right now?</p>



<p><a href="https://time.is/" target="_blank" rel="noreferrer noopener" aria-label="Time.is (opens in a new tab)">Time.is</a> is that place that tells you not only what the time is now but checks if your computer clock is off.</p>



<figure class="wp-block-image"><img loading="lazy" decoding="async" width="952" height="475" src="https://i1.wp.com/www.kjctech.net/wp-content/uploads/2019/06/image-14.png?fit=600%2C299&amp;ssl=1" alt="" class="wp-image-4369" srcset="https://i0.wp.com/www.kjctech.net/wp-content/uploads/2019/06/image-14.png?w=952&amp;ssl=1 952w, https://i0.wp.com/www.kjctech.net/wp-content/uploads/2019/06/image-14.png?resize=250%2C125&amp;ssl=1 250w, https://i0.wp.com/www.kjctech.net/wp-content/uploads/2019/06/image-14.png?resize=450%2C225&amp;ssl=1 450w, https://i0.wp.com/www.kjctech.net/wp-content/uploads/2019/06/image-14.png?resize=768%2C383&amp;ssl=1 768w, https://i0.wp.com/www.kjctech.net/wp-content/uploads/2019/06/image-14.png?resize=600%2C299&amp;ssl=1 600w, https://i0.wp.com/www.kjctech.net/wp-content/uploads/2019/06/image-14.png?resize=700%2C349&amp;ssl=1 700w, https://i0.wp.com/www.kjctech.net/wp-content/uploads/2019/06/image-14.png?resize=520%2C259&amp;ssl=1 520w, https://i0.wp.com/www.kjctech.net/wp-content/uploads/2019/06/image-14.png?resize=360%2C180&amp;ssl=1 360w, https://i0.wp.com/www.kjctech.net/wp-content/uploads/2019/06/image-14.png?resize=100%2C50&amp;ssl=1 100w" sizes="auto, (max-width: 640px) 100vw, 640px" /></figure>



<h2 class="wp-block-heading">How to sync time for Domain Controller</h2>



<p>Since my domain controller is virtualized, I don&#8217;t actually need to do anything on AD level. All I need is to make sure the host that all VMs rely on has an accurate time all the time. Basically, I can enable the NTP Client on the host and have it sync to specified NTP servers.</p>



<figure class="wp-block-image"><img data-recalc-dims="1" loading="lazy" decoding="async" width="594" height="262" src="https://i0.wp.com/www.kjctech.net/wp-content/uploads/2019/06/image-15.png?resize=594%2C262&#038;ssl=1" alt="" class="wp-image-4370" srcset="https://i0.wp.com/www.kjctech.net/wp-content/uploads/2019/06/image-15.png?w=594&amp;ssl=1 594w, https://i0.wp.com/www.kjctech.net/wp-content/uploads/2019/06/image-15.png?resize=250%2C110&amp;ssl=1 250w, https://i0.wp.com/www.kjctech.net/wp-content/uploads/2019/06/image-15.png?resize=450%2C198&amp;ssl=1 450w, https://i0.wp.com/www.kjctech.net/wp-content/uploads/2019/06/image-15.png?resize=520%2C229&amp;ssl=1 520w, https://i0.wp.com/www.kjctech.net/wp-content/uploads/2019/06/image-15.png?resize=360%2C159&amp;ssl=1 360w, https://i0.wp.com/www.kjctech.net/wp-content/uploads/2019/06/image-15.png?resize=100%2C44&amp;ssl=1 100w" sizes="auto, (max-width: 594px) 100vw, 594px" /></figure>



<p>If setting up NTP on the host level isn&#8217;t an option, maybe because the host doesn&#8217;t have the access to the internet, here is what you can also do.</p>



<p>Open an elevated Command Prompted window on the domain controller and run the following command:</p>



<pre class="wp-block-preformatted">net stop w32time
w32tm /config /manualpeerlist:"0.uk.pool.ntp.org,0x1 1.uk.pool.ntp.org,0x1 2.uk.pool.ntp.org,0x1 3.uk.pool.ntp.org,0x1"
w32tm /config /reliable:yes
net start w32time</pre>



<p>Now, running <code>w32tm /resync</code> should be completed successfully.</p>



<h2 class="wp-block-heading">How to sync time on domain workstations</h2>



<p>The quickest way to sync your computer with the domain time is to run the following command in an elevated Command Prompt window.</p>



<pre class="wp-block-preformatted">net time /domain</pre>



<p>You can schedule it or put it as part of your login script so it runs frequently enough to keep the time synced with AD all the time. But obviously, it&#8217;s not ideal because it&#8217;s better done in Group Policy level if you are in an AD environment.</p>



<p>Open the Group Policy assigned to an OU that includes all the workstations on your network and then navigate to the following location:</p>



<pre class="wp-block-preformatted">Computer Configuration > Policies > Administrative Templates > System > Windows Time Service > Time Providers</pre>



<p>Enable the <strong>Configure Windows NTP Client</strong> policy and set <em>yourdc.yourdomain,0x1</em> as the <strong>NtpServer</strong>.</p>



<p>And enable the &#8220;<strong>Enable Windows NTP Client</strong>&#8221; policy afterwards.</p>



<figure class="wp-block-image"><a href="//i0.wp.com/kjctech.net/wp-content/uploads/2019/06/image-16.png" data-rel="lightbox-image-0" data-rl_title="" data-rl_caption="" title=""><img loading="lazy" decoding="async" width="787" height="565" src="https://i1.wp.com/www.kjctech.net/wp-content/uploads/2019/06/image-16.png?fit=600%2C431&amp;ssl=1" alt="" class="wp-image-4371" srcset="https://i0.wp.com/www.kjctech.net/wp-content/uploads/2019/06/image-16.png?w=787&amp;ssl=1 787w, https://i0.wp.com/www.kjctech.net/wp-content/uploads/2019/06/image-16.png?resize=250%2C179&amp;ssl=1 250w, https://i0.wp.com/www.kjctech.net/wp-content/uploads/2019/06/image-16.png?resize=450%2C323&amp;ssl=1 450w, https://i0.wp.com/www.kjctech.net/wp-content/uploads/2019/06/image-16.png?resize=768%2C551&amp;ssl=1 768w, https://i0.wp.com/www.kjctech.net/wp-content/uploads/2019/06/image-16.png?resize=600%2C431&amp;ssl=1 600w, https://i0.wp.com/www.kjctech.net/wp-content/uploads/2019/06/image-16.png?resize=700%2C503&amp;ssl=1 700w, https://i0.wp.com/www.kjctech.net/wp-content/uploads/2019/06/image-16.png?resize=520%2C373&amp;ssl=1 520w, https://i0.wp.com/www.kjctech.net/wp-content/uploads/2019/06/image-16.png?resize=360%2C258&amp;ssl=1 360w, https://i0.wp.com/www.kjctech.net/wp-content/uploads/2019/06/image-16.png?resize=100%2C72&amp;ssl=1 100w" sizes="auto, (max-width: 640px) 100vw, 640px" /></a></figure>



<p>To test it out, you can either reboot a workstation or run <code>GPUpdate /Force</code> to update the policy on the local computer and run the following to display the status of the time service.</p>



<pre class="wp-block-preformatted">w32tm /query /status</pre>



<p>That&#8217;s about it. Here are a few w32tm command options that you use to find more information:</p>



<p><strong>w32tm /query /configuration</strong>&nbsp;– check NTP configuration</p>



<p><strong>w32tm /query /source</strong>&nbsp;– display time source</p>



<p><strong>w32tm /query /peers</strong>&nbsp;– display the list of all configured NTP servers and their status</p>The post <a href="https://www.kjctech.net/syncing-time-within-an-active-directory-domain-checklist/">Syncing Time within An Active Directory Domain Checklist</a> first appeared on <a href="https://www.kjctech.net">KC's Blog</a>.]]></content:encoded>
					
					<wfw:commentRss>https://www.kjctech.net/syncing-time-within-an-active-directory-domain-checklist/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
		<post-id xmlns="com-wordpress:feed-additions:1">4368</post-id>	</item>
		<item>
		<title>Do You Need to Update KRBTGT Account Password?</title>
		<link>https://www.kjctech.net/do-you-need-to-update-krbtgt-account-password/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=do-you-need-to-update-krbtgt-account-password</link>
					<comments>https://www.kjctech.net/do-you-need-to-update-krbtgt-account-password/#comments</comments>
		
		<dc:creator><![CDATA[Kent Chen]]></dc:creator>
		<pubDate>Fri, 22 Mar 2019 23:37:52 +0000</pubDate>
				<category><![CDATA[Microsoft]]></category>
		<category><![CDATA[Active Directory]]></category>
		<category><![CDATA[Security]]></category>
		<guid isPermaLink="false">https://www.kjctech.net/?p=4266</guid>

					<description><![CDATA[<p>A Reddit user raised this great question today that I am not aware of. So I did a little research and here is the breakdown of what it is. What is KRBTGT? The KRBTGT is a local default account that acts as a service account for the Key Distribution Center (KDC) service. It&#8217;s created automatically when a new domain is [&#8230;]</p>
The post <a href="https://www.kjctech.net/do-you-need-to-update-krbtgt-account-password/">Do You Need to Update KRBTGT Account Password?</a> first appeared on <a href="https://www.kjctech.net">KC's Blog</a>.]]></description>
										<content:encoded><![CDATA[<p>A Reddit user raised <a href="https://www.reddit.com/r/sysadmin/comments/b456i1/how_many_of_you_guys_change_the_krbtgt_password/" target="_blank" rel="noreferrer noopener" aria-label="this great  (opens in a new tab)">this great </a>question today that I am not aware of. So I did a little research and here is the breakdown of what it is.</p>



<h2 class="wp-block-heading">What is KRBTGT?</h2>



<p>The <strong>KRBTGT</strong> is a local default account that acts as a service account for the <strong>Key Distribution Center (KDC)</strong> service. It&#8217;s created automatically when a new domain is created.</p>



<ul class="wp-block-list"><li>It cannot be deleted</li><li>its name cannot be changed</li><li>it cannot be enabled</li><li>it only belongs to the following two groups<ul><li>Domain Users</li><li>Denied RODC Password Replication Group</li></ul></li></ul>



<p>KDC service handles all Kerberos ticket requests so KRBTGT account in AD plays a key role that encrypts and sign all Kerberos tickets for the domain.</p>



<figure class="wp-block-image"><img data-recalc-dims="1" loading="lazy" decoding="async" width="425" height="317" src="https://i0.wp.com/www.kjctech.net/wp-content/uploads/2019/03/image-10.png?resize=425%2C317&#038;ssl=1" alt="" class="wp-image-4268" srcset="https://i0.wp.com/www.kjctech.net/wp-content/uploads/2019/03/image-10.png?w=425&amp;ssl=1 425w, https://i0.wp.com/www.kjctech.net/wp-content/uploads/2019/03/image-10.png?resize=250%2C186&amp;ssl=1 250w, https://i0.wp.com/www.kjctech.net/wp-content/uploads/2019/03/image-10.png?resize=360%2C269&amp;ssl=1 360w, https://i0.wp.com/www.kjctech.net/wp-content/uploads/2019/03/image-10.png?resize=100%2C75&amp;ssl=1 100w" sizes="auto, (max-width: 425px) 100vw, 425px" /></figure>



<p>You can also use the PowerShell code to get the account&#8217;s detail as well:</p>



<pre class="wp-block-preformatted">Get-AdUser krbtgt -property created, passwordlastset, enabled, sid, distinguishedname<br></pre>



<figure class="wp-block-image"><a href="//i0.wp.com/kjctech.net/wp-content/uploads/2019/03/image-9.png" data-rel="lightbox-image-0" data-rl_title="" data-rl_caption="" title=""><img loading="lazy" decoding="async" width="705" height="304" src="https://i1.wp.com/www.kjctech.net/wp-content/uploads/2019/03/image-9.png?fit=600%2C259&amp;ssl=1" alt="" class="wp-image-4267" srcset="https://i0.wp.com/www.kjctech.net/wp-content/uploads/2019/03/image-9.png?w=705&amp;ssl=1 705w, https://i0.wp.com/www.kjctech.net/wp-content/uploads/2019/03/image-9.png?resize=250%2C108&amp;ssl=1 250w, https://i0.wp.com/www.kjctech.net/wp-content/uploads/2019/03/image-9.png?resize=450%2C194&amp;ssl=1 450w, https://i0.wp.com/www.kjctech.net/wp-content/uploads/2019/03/image-9.png?resize=600%2C259&amp;ssl=1 600w, https://i0.wp.com/www.kjctech.net/wp-content/uploads/2019/03/image-9.png?resize=700%2C302&amp;ssl=1 700w, https://i0.wp.com/www.kjctech.net/wp-content/uploads/2019/03/image-9.png?resize=520%2C224&amp;ssl=1 520w, https://i0.wp.com/www.kjctech.net/wp-content/uploads/2019/03/image-9.png?resize=360%2C155&amp;ssl=1 360w, https://i0.wp.com/www.kjctech.net/wp-content/uploads/2019/03/image-9.png?resize=100%2C43&amp;ssl=1 100w" sizes="auto, (max-width: 640px) 100vw, 640px" /></a></figure>



<h2 class="wp-block-heading">How it works:</h2>



<ol class="wp-block-list"><li>User logs on with AD user name and password to a domain-joined computer (usually a workstation).</li><li>The user requests authentication by sending a timestamp (Pre-auth data) encrypted with the users password-based encryption key (password hash).</li><li>User account (user@adsecurity.org) requests a Kerberos service ticket (TGT) with PREAUTH data (Kerberos AS-REQ).</li><li>The Kerberos server (KDC) receives the authentication request, validates the data, and replies with a TGT (Kerberos AS-REP).</li></ol>



<h2 class="wp-block-heading">Why do you need to update its password?</h2>



<p>99.99% of the time, the KRBTGT account&#8217;s password has not changed since the AD Domain was set up. But since it&#8217;s a domain account, all writable DCs know the account password in order to decrypt Kerberos tickets for validation.</p>



<p>Because of that, the attackers may use the KRBTGT account to persist on the network even if every other account has its password changed. During an <a href="http://www.slideshare.net/gentilkiwi/abusing-microsoft-kerberos-sorry-you-guys-dont-get-it">incredibly awesome talk</a> (<a href="https://t.co/z9RUr0Hfl9">Video</a>) at the Black Hat 2014 security conference in Las Vegas, NV in early August, Skip Duckwall &amp; Benjamin Delpy spoke about a method (using <a href="https://adsecurity.org/?p=556">Mimikatz</a>) to generate your own Kerberos tickets (aka the <strong>Golden Ticket</strong>). </p>



<p>And that&#8217;s why Microsoft now <a href="https://technet.microsoft.com/en-us/library/dn745899.aspx#Anchor_5">recommends that the KRBTGT password change on a regular basis</a>. </p>



<h2 class="wp-block-heading">How to change the password?</h2>



<p>Microsoft posted a&nbsp;<a href="https://gallery.technet.microsoft.com/Reset-the-krbtgt-account-581a9e51">KRBTGT account password PowerShell script on TechNet</a>&nbsp;that will change the KRBTGT account password once for a domain, force replication, and monitor change status.</p>



<p>Note that changing the KRBTGT account password in a 2008 (or higher) DFL will not cause replication issues.</p>



<p>There are two KRBTGT Password Change Scenarios:</p>



<ul class="wp-block-list"><li>Maintenance: Changing the KRBTGT account password once, waiting for replication to complete (and the forest converge), and then changing the password a second time, provides a solid process for ensuring the KRBTGT account is protected and reduces risk (Kerberos and application issues).</li><li>Breach Recovery: Changing the KRBTGT account password twice in rapid succession (before AD replication completes) will invalidate all existing TGTs forcing clients to re-authenticate since the KDC service will be unable to decrypt the existing TGTs. Choosing this path will likely require rebooting application servers (or at least re-starting application services to get them talking Kerberos correctly again).</li></ul>



<h2 class="wp-block-heading">Resources:</h2>



<ul class="wp-block-list"><li><a href="https://adsecurity.org/?p=483">Kerberos &amp; KRBTGT: Active Directory&#8217;s Domain Kerberos Service Account</a></li><li><a href="https://docs.microsoft.com/en-us/previous-versions/windows/it-pro/windows-server-2012-R2-and-2012/dn745899(v=ws.11)#Anchor_5">Active Directory Accounts</a></li><li><a href="https://gallery.technet.microsoft.com/Reset-the-krbtgt-account-581a9e51">Reset the krbtgt account password/keys</a></li><li></li></ul>The post <a href="https://www.kjctech.net/do-you-need-to-update-krbtgt-account-password/">Do You Need to Update KRBTGT Account Password?</a> first appeared on <a href="https://www.kjctech.net">KC's Blog</a>.]]></content:encoded>
					
					<wfw:commentRss>https://www.kjctech.net/do-you-need-to-update-krbtgt-account-password/feed/</wfw:commentRss>
			<slash:comments>6</slash:comments>
		
		
		<post-id xmlns="com-wordpress:feed-additions:1">4266</post-id>	</item>
		<item>
		<title>Gather Bad Password Attempts and Account Lockout Info in PowerShell</title>
		<link>https://www.kjctech.net/gather-bad-password-attempts-and-account-lockout-info-in-powershell/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=gather-bad-password-attempts-and-account-lockout-info-in-powershell</link>
					<comments>https://www.kjctech.net/gather-bad-password-attempts-and-account-lockout-info-in-powershell/#comments</comments>
		
		<dc:creator><![CDATA[Kent Chen]]></dc:creator>
		<pubDate>Thu, 26 Jul 2018 06:26:53 +0000</pubDate>
				<category><![CDATA[Microsoft]]></category>
		<category><![CDATA[Active Directory]]></category>
		<category><![CDATA[event log]]></category>
		<category><![CDATA[powershell]]></category>
		<guid isPermaLink="false">https://www.kjctech.net/?p=4149</guid>

					<description><![CDATA[<p>If a user account gets locked out, I can follow these tips to find out why and when it happened. But how can I check and gather lockout info along with the bad password attempts info of all users across the entire AD domain? Asking help from PowerShell is my answer. There are two places where we can gather this [&#8230;]</p>
The post <a href="https://www.kjctech.net/gather-bad-password-attempts-and-account-lockout-info-in-powershell/">Gather Bad Password Attempts and Account Lockout Info in PowerShell</a> first appeared on <a href="https://www.kjctech.net">KC's Blog</a>.]]></description>
										<content:encoded><![CDATA[<p>If a user account gets locked out, I can follow t<a href="https://www.kjctech.net/why-my-windows-active-directory-domain-account-is-locked-out/">hese tips</a> to find out why and when it happened. But how can I check and gather lockout info along with the bad password attempts info of all users across the entire AD domain?</p>



<p>Asking help from PowerShell is my answer.</p>



<p>There are two places where we can gather this information. The AD contains the bad password attempts and the lockout status while the security event log saves the user account lockout information when it happens.</p>



<p>To get bad password attempts info from AD, use <strong>Get-ADUser</strong> cmdlet.</p>



<pre class="wp-block-preformatted">Get-ADUser -Filter * -Properties AccountLockoutTime,LastBadPasswordAttemptBadPwdCount,LockedOut</pre>



<p>If you want just the info for the past day, pipe the result to Where clause.</p>



<pre class="wp-block-preformatted">Get-ADUser -Filter * -Properties AccountLockoutTime,LastBadPasswordAttemptBadPwdCount,LockedOut | Where {$_.LastBadPasswordAttempt -gt (Get-Date).AddDays(-1)}<br/></pre>



<p>To get the account lockout info, use <strong>Get-EventLog</strong> cmd to find all entries with the event ID 4740. Use -After switch to narrow down the date.</p>



<pre class="wp-block-preformatted">Get-EventLog -LogName "Security" -ComputerName "AD_Server" -After (Get-Date).AddDays(-1) -InstanceID "4740" | Select TimeGenerated, ReplacementString<br/></pre>



<p>Depending on the size of the log file, it could take a while to get all the result.</p>



<p>Going through the result, you may find the data shown on the screen is incomplete. That&#8217;s because the <strong>ReplacementString</strong> is a string array that contains the event log data in an XML type of format. Each event type has its own string structure. For 4740 events, </p>



<ul class="wp-block-list"><li>ReplacementString[0] stores the name of the computer where the account gets locked out and </li><li>ReplacementString[1] indicates the name of the user account that gets locked out.</li></ul>



<p>So, instead of running the above cmdlet, the following script provides a lot more clear useful info.</p>



<pre class="wp-block-code"><code lang="javascript" class="language-javascript">#Collect lockout accounts from ADS

$logname = "security"
$dcname = (Get-AdDomain).pdcemulator
$eventID = "4740"
$content = Get-EventLog -LogName $logname -ComputerName $dcname -After (Get-Date).AddDays(-1) -InstanceId $eventID | Select TimeGenerated, ReplacementStrings
$ofs = "`r`n`r`n"
$body = "Fetching event log started on " + (Get-Date) + $ofs

If ($content -eq $null)
{
    $body = $body + "No lock-out accounts happened today" + $ofs
}
Else 
{
    Foreach ($event in $content)
    {
        $source = $content.ReplacementStrings[1]
        $username = $content.ReplacementStrings[0]
        $body = $body + $event.TimeGenerated + ": " + $username + " - " + $source + $ofs
    }
}
$body</code></pre>



<p>Hope it helps.</p>The post <a href="https://www.kjctech.net/gather-bad-password-attempts-and-account-lockout-info-in-powershell/">Gather Bad Password Attempts and Account Lockout Info in PowerShell</a> first appeared on <a href="https://www.kjctech.net">KC's Blog</a>.]]></content:encoded>
					
					<wfw:commentRss>https://www.kjctech.net/gather-bad-password-attempts-and-account-lockout-info-in-powershell/feed/</wfw:commentRss>
			<slash:comments>9</slash:comments>
		
		
		<post-id xmlns="com-wordpress:feed-additions:1">4149</post-id>	</item>
	</channel>
</rss>
