<?xml version="1.0" encoding="utf-8" standalone="yes"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom">
  <channel>
    <title>Powershell on oasysadmin</title>
    <link>https://oasysadmin.com/tags/powershell/</link>
    <description>Recent content in Powershell on oasysadmin</description>
    <generator>Hugo</generator>
    <language>en-gb</language>
    <lastBuildDate>Thu, 04 Feb 2016 00:00:00 +0000</lastBuildDate>
    <atom:link href="https://oasysadmin.com/tags/powershell/index.xml" rel="self" type="application/rss+xml" />
    <item>
      <title>Force a manual sync with Microsoft Entra Connect (formerly Azure AD Connect)</title>
      <link>https://oasysadmin.com/blog/force-manual-synchronisation-when-using-azure-ad-connect/</link>
      <pubDate>Thu, 04 Feb 2016 00:00:00 +0000</pubDate>
      <guid>https://oasysadmin.com/blog/force-manual-synchronisation-when-using-azure-ad-connect/</guid>
      <description>&lt;blockquote&gt;&#xA;&lt;p&gt;&lt;strong&gt;Updated November 2026.&lt;/strong&gt; Azure AD Connect is now &lt;strong&gt;Microsoft Entra Connect Sync&lt;/strong&gt;, and the 2016 method (&lt;code&gt;DirectorySyncClientCmd delta&lt;/code&gt;) has been replaced by a PowerShell cmdlet.&lt;/p&gt;&lt;/blockquote&gt;&#xA;&lt;p&gt;By default, Entra Connect syncs every 30 minutes. When you&amp;rsquo;ve just created a user, changed a group or fixed an attribute and don&amp;rsquo;t want to wait, you can trigger a sync yourself.&lt;/p&gt;&#xA;&lt;h2 id=&#34;run-a-sync-now&#34;&gt;Run a sync now&lt;/h2&gt;&#xA;&lt;p&gt;On the Entra Connect server, in an elevated PowerShell window:&lt;/p&gt;</description>
    </item>
    <item>
      <title>Find out if an update, hotfix or KB is installed with PowerShell</title>
      <link>https://oasysadmin.com/blog/find-out-if-an-update-hotfix-or-kb-is-installed-on-a-windows-server-using-powershell/</link>
      <pubDate>Wed, 03 Feb 2016 00:00:00 +0000</pubDate>
      <guid>https://oasysadmin.com/blog/find-out-if-an-update-hotfix-or-kb-is-installed-on-a-windows-server-using-powershell/</guid>
      <description>&lt;blockquote&gt;&#xA;&lt;p&gt;&lt;strong&gt;Updated November 2026.&lt;/strong&gt; &lt;code&gt;Get-HotFix&lt;/code&gt; still does the job. I&amp;rsquo;ve added checking several servers at once, its limitations, and a short tip from a separate old post on finding the PowerShell version.&lt;/p&gt;&lt;/blockquote&gt;&#xA;&lt;h2 id=&#34;one-machine&#34;&gt;One machine&lt;/h2&gt;&#xA;&lt;pre&gt;&lt;code class=&#34;language-powershell&#34;&gt;Get-HotFix -Id KB5048667&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;If it&amp;rsquo;s installed, you&amp;rsquo;ll see the KB, its description and install date. If not, you&amp;rsquo;ll get an error saying it can&amp;rsquo;t be found.&lt;/p&gt;&#xA;&lt;h2 id=&#34;several-servers-at-once&#34;&gt;Several servers at once&lt;/h2&gt;&#xA;&lt;pre&gt;&lt;code class=&#34;language-powershell&#34;&gt;$servers = &amp;quot;SRV01&amp;quot;, &amp;quot;SRV02&amp;quot;, &amp;quot;SRV03&amp;quot;&#xA;foreach ($s in $servers) {&#xA;    [pscustomobject]@{&#xA;        Server    = $s&#xA;        Installed = [bool](Get-HotFix -Id KB5048667 -ComputerName $s -ErrorAction SilentlyContinue)&#xA;    }&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;h2 id=&#34;latest-updates-installed&#34;&gt;Latest updates installed&lt;/h2&gt;&#xA;&lt;pre&gt;&lt;code class=&#34;language-powershell&#34;&gt;Get-HotFix | Sort-Object InstalledOn -Descending | Select-Object -First 10&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;h2 id=&#34;limitations&#34;&gt;Limitations&lt;/h2&gt;&#xA;&lt;p&gt;&lt;code&gt;Get-HotFix&lt;/code&gt; reads &lt;code&gt;Win32_QuickFixEngineering&lt;/code&gt;, which lists Windows component updates. It doesn&amp;rsquo;t show everything: Defender definition updates, Microsoft Store apps and some .NET or Office updates don&amp;rsquo;t appear. For those, check &lt;strong&gt;Settings → Windows Update → Update history&lt;/strong&gt;, or your patch management tool (WSUS, Intune, Azure Update Manager).&lt;/p&gt;</description>
    </item>
    <item>
      <title>DFSR not replicating certain files (the temporary attribute)</title>
      <link>https://oasysadmin.com/blog/frs-or-dfsr-not-replicating-certain-files/</link>
      <pubDate>Mon, 05 Mar 2012 00:00:00 +0000</pubDate>
      <guid>https://oasysadmin.com/blog/frs-or-dfsr-not-replicating-certain-files/</guid>
      <description>&lt;blockquote&gt;&#xA;&lt;p&gt;&lt;strong&gt;Updated November 2026.&lt;/strong&gt; The original issue was with FRS, which is long deprecated: newer Windows Server versions can&amp;rsquo;t use it for SYSVOL, so domains should have migrated to DFSR. The same behaviour applies to DFSR, so the fix is unchanged.&lt;/p&gt;&lt;/blockquote&gt;&#xA;&lt;h2 id=&#34;the-problem&#34;&gt;The problem&lt;/h2&gt;&#xA;&lt;p&gt;I added a JPEG to the SYSVOL share for a Group Policy Preferences file copy. A week later, clients still weren&amp;rsquo;t getting it. The file was only on the domain controller I&amp;rsquo;d copied it to; the replication logs showed no errors, and a test text file replicated straight away.&lt;/p&gt;</description>
    </item>
    <item>
      <title>Force reboot of a remote server that has hung shutting down</title>
      <link>https://oasysadmin.com/blog/force-reboot-of-a-remote-server-that-has-hung-shutting-down/</link>
      <pubDate>Fri, 02 Mar 2012 00:00:00 +0000</pubDate>
      <guid>https://oasysadmin.com/blog/force-reboot-of-a-remote-server-that-has-hung-shutting-down/</guid>
      <description>&lt;blockquote&gt;&#xA;&lt;p&gt;&lt;strong&gt;Updated November 2026.&lt;/strong&gt; I first wrote this in 2012 about a Windows Server 2008 R2 box. The story still stands, but I&amp;rsquo;ve added the approach I&amp;rsquo;d take today.&lt;/p&gt;&lt;/blockquote&gt;&#xA;&lt;h2 id=&#34;the-problem&#34;&gt;The problem&lt;/h2&gt;&#xA;&lt;p&gt;I was patching a remote server late one night when it hung while shutting down. I could still ping it and reach its file shares, but RDP was gone. I was facing a long drive the next day just to press a reset button, so I looked for a way to force a reboot remotely first.&lt;/p&gt;</description>
    </item>
    <item>
      <title>Find an Active Directory user&#39;s OU with PowerShell</title>
      <link>https://oasysadmin.com/blog/find-an-active-directory-users-organizational-unit-ou-using-powershell/</link>
      <pubDate>Wed, 22 Feb 2012 00:00:00 +0000</pubDate>
      <guid>https://oasysadmin.com/blog/find-an-active-directory-users-organizational-unit-ou-using-powershell/</guid>
      <description>&lt;blockquote&gt;&#xA;&lt;p&gt;&lt;strong&gt;Updated November 2026.&lt;/strong&gt; The original one-liner still works. I&amp;rsquo;ve added ways to show just the OU and to search when you only know part of a name.&lt;/p&gt;&lt;/blockquote&gt;&#xA;&lt;p&gt;Active Directory Users and Computers can find a user, but it doesn&amp;rsquo;t make it obvious which OU they&amp;rsquo;re in. PowerShell does (it needs the Active Directory module, part of RSAT).&lt;/p&gt;&#xA;&lt;h2 id=&#34;by-username&#34;&gt;By username&lt;/h2&gt;&#xA;&lt;pre&gt;&lt;code class=&#34;language-powershell&#34;&gt;Get-ADUser jbloggs | Select-Object Name, DistinguishedName&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;The distinguished name shows the full path, for example &lt;code&gt;CN=Joe Bloggs,OU=Users,OU=London,DC=contoso,DC=com&lt;/code&gt;.&lt;/p&gt;</description>
    </item>
    <item>
      <title>Back up all Group Policy Objects with Backup-GPO and the GPMC</title>
      <link>https://oasysadmin.com/blog/back-up-all-group-policy-objects-using-backup-gpo-and-the-group-policy-management-console/</link>
      <pubDate>Tue, 14 Feb 2012 00:00:00 +0000</pubDate>
      <guid>https://oasysadmin.com/blog/back-up-all-group-policy-objects-using-backup-gpo-and-the-group-policy-management-console/</guid>
      <description>&lt;blockquote&gt;&#xA;&lt;p&gt;&lt;strong&gt;Updated November 2026.&lt;/strong&gt; The commands are unchanged. I&amp;rsquo;ve added what a GPO backup doesn&amp;rsquo;t cover, and how to schedule it.&lt;/p&gt;&lt;/blockquote&gt;&#xA;&lt;h2 id=&#34;method-1-powershell&#34;&gt;Method 1: PowerShell&lt;/h2&gt;&#xA;&lt;p&gt;On a domain controller, or any machine with the Group Policy RSAT tools:&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code class=&#34;language-powershell&#34;&gt;Backup-GPO -All -Path &amp;quot;C:\GPOBackups\$(Get-Date -Format yyyy-MM-dd)&amp;quot;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;The dated folder keeps each run separate. Create the folder first if your PowerShell version complains it doesn&amp;rsquo;t exist.&lt;/p&gt;&#xA;&lt;h2 id=&#34;method-2-the-group-policy-management-console&#34;&gt;Method 2: the Group Policy Management Console&lt;/h2&gt;&#xA;&lt;p&gt;In &lt;code&gt;gpmc.msc&lt;/code&gt;, expand your domain, right-click &lt;strong&gt;Group Policy Objects&lt;/strong&gt; → &lt;strong&gt;Back Up All…&lt;/strong&gt;&lt;/p&gt;</description>
    </item>
    <item>
      <title>Export a list of members from an Active Directory group</title>
      <link>https://oasysadmin.com/blog/export-a-list-of-members-from-an-active-directory-group-to-a-text-file/</link>
      <pubDate>Fri, 06 Jan 2012 00:00:00 +0000</pubDate>
      <guid>https://oasysadmin.com/blog/export-a-list-of-members-from-an-active-directory-group-to-a-text-file/</guid>
      <description>&lt;blockquote&gt;&#xA;&lt;p&gt;&lt;strong&gt;Updated November 2026.&lt;/strong&gt; The 2012 commands still work. PowerShell is now the better option, and I&amp;rsquo;ve added Entra ID groups too.&lt;/p&gt;&lt;/blockquote&gt;&#xA;&lt;p&gt;In every example, replace &lt;code&gt;Group Name&lt;/code&gt; with the name of your group.&lt;/p&gt;&#xA;&lt;h2 id=&#34;quick-and-simple-net-group&#34;&gt;Quick and simple: &lt;code&gt;net group&lt;/code&gt;&lt;/h2&gt;&#xA;&lt;pre&gt;&lt;code class=&#34;language-bat&#34;&gt;net group &amp;quot;Group Name&amp;quot; /domain &amp;gt; memberlist.txt&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;This gives you a list of usernames. It&amp;rsquo;s handy for a quick look, but the output is in columns and awkward to reuse.&lt;/p&gt;</description>
    </item>
  </channel>
</rss>
