<?xml version="1.0" encoding="utf-8"?>
<rss xmlns:atom="https://www.w3.org/2005/Atom" xmlns:sy="https://purl.org/rss/1.0/modules/syndication/" xmlns:dc="https://purl.org/dc/elements/1.1/" xmlns:content="https://purl.org/rss/1.0/modules/content/" xmlns:wfw="https://wellformedweb.org/CommentAPI/" xmlns:slash="https://purl.org/rss/1.0/modules/slash/"
  version="2.0">
  <channel>
    <title>PoSh Chap</title>
    <atom:link
      href="https://docs.microsoft.com/archive/blogs/poshchap/feed.xml"
      rel="self"
      type="application/rss+xml" />
    <link>https://docs.microsoft.com/archive/blogs/poshchap/feed.xml</link>
    <description>Musings on the splendour of PowerShell...</description>
    <lastBuildDate>Thu, 26 Jul 2018 10:30:12 GMT</lastBuildDate>
    <language>en-US</language>
    <sy:updatePeriod>hourly</sy:updatePeriod>
    <sy:updateFrequency>1</sy:updateFrequency>
    <item>
      <title>Use Azure AD PowerShell to Check Synchronised On-Premises AD extensionAttributes 1-15</title>
      <link>https://docs.microsoft.com/archive/blogs/poshchap/use-azure-ad-powershell-to-check-synchronised-on-premises-ad-extensionattributes-1-15</link>
      <pubDate>Thu, 26 Jul 2018 10:21:45 GMT</pubDate>
      <dc:creator><![CDATA[Ian Farr [MSFT]]]></dc:creator>
      <guid
        isPermaLink="false">https://blogs.technet.microsoft.com/poshchap/?p=6535</guid>
      <description><![CDATA[You wait 271 days for a new PoSh Chap post and, like London buses, two come along at...]]></description>
      <content:encoded><![CDATA[You wait 271 days for a <a href="https://blogs.technet.microsoft.com/poshchap/2018/07/25/use-microsoft-graph-to-check-synchronised-on-premises-ad-extensionattributes1-15/">new PoSh Chap post</a> and, like London buses, two come along at once!

&nbsp;
<p style="padding-left: 30px"><a href="https://msdnshared.blob.core.windows.net/media/2018/07/buses.jpg"><img width="500" height="327" class="alignnone wp-image-6545" alt="" src="https://msdnshared.blob.core.windows.net/media/2018/07/buses-1024x670.jpg" /></a></p>
&nbsp;

<strong>How can we use the Azure AD PowerShell module to check for users that have extensionAttributes sync'd up to Azure AD?</strong>

Here's how...

Use the <strong>Get-AzureADApplication</strong> and <strong>Get-AzureADApplicationExtensionProperty</strong> to retrieve a base value representing the <strong>extentionAttributes</strong> as they appear in Azure AD. The application ID of the 'Tenant Schema Extension App' forms the middle part of the name of each <strong>extensionAttribute</strong> when sync'd to azure AD, just like this:

&nbsp;
<p style="padding-left: 30px">extension_9c0741cdf21149d1bcee83ccd513b92f_extensionAttribute9</p>
<p style="padding-left: 30px">extension_9c0741cdf21149d1bcee83ccd513b92f_extensionAttribute4</p>
<p style="padding-left: 30px">extension_9c0741cdf21149d1bcee83ccd513b92f_extensionAttribute15</p>
&nbsp;

The PowerShell removes the integer at the end of the extension property so we can use it as a base value when checking if a user has an of the on-premises extension attributes associated with their account.

&nbsp;
<p style="padding-left: 30px">extension_9c0741cdf21149d1bcee83ccd513b92f_extensionAttribute</p>
&nbsp;

Here's the PowerShell:
<pre style="padding-left: 30px"><code>
#Get an extensionAttribute property from the 'Tenant Schema Extension App' - this will be used to check user extension properties
$ExtAttribute = (Get-AzureADApplication -SearchString "Tenant Schema Extension App" | 
                 Get-AzureADApplicationExtensionProperty | 
                 Where-Object {$_.Name -like "*extensionAttribute*"} | 
                 Select-Object -First 1).Name.Substring(0,61)

</code></pre>
&nbsp;

We now use <strong>Get-AzureADUser</strong> to retrieve all of the users in the tenant. For each user we examine the contents of their <strong>ExtensionProperty</strong> attribute and attempt to match them to the base value, <strong>$ExtAttribute</strong>, captured before we retrieved the users.<strong> Switch</strong> with a <strong>wildcard</strong> drives the matching and, if we match, we write the following details to the PowerShell host: <strong>UserPrincipalName</strong> with the ‘<strong>extensionAttribute</strong>’ and its value.

&nbsp;

Here's the PowerShell:
<pre style="padding-left: 30px"><code>
#If we have an extenstionAttribute property then proceed with the user search
if ($ExtAttribute) {

    #Get all Azure AD users
    Get-AzureADUser -All $true | ForEach-Object {

        #Variable for current user
        $User = $_.UserPrincipalName

        #Variable for extension properties
        $ExtProperties = $_.ExtensionProperty

        #Check for presence of extension attribute
        switch -Wildcard ($ExtProperties.Keys) {

            "$ExtAttribute*" {Write-Output "$User,$($_.substring(43)),$($ExtProperties.Item($_))"}

        } #end switch

    } #end foreach-object

} #end if

</code></pre>
&nbsp;

Here's some sample output:
<p style="padding-left: 30px"><a href="https://msdnshared.blob.core.windows.net/media/2018/07/Capture269.png"><img width="400" height="426" class="alignnone wp-image-6505" alt="" src="https://msdnshared.blob.core.windows.net/media/2018/07/Capture269.png" /></a></p>
&nbsp;

The 'Shell will also dump out where a user has more than one '<strong>extensionAttribute</strong>' set:
<p style="padding-left: 30px"><a href="https://msdnshared.blob.core.windows.net/media/2018/07/Capture270.png"><img width="400" height="45" class="alignnone wp-image-6515" alt="" src="https://msdnshared.blob.core.windows.net/media/2018/07/Capture270.png" /></a></p>
&nbsp;]]></content:encoded>
    </item>
    <item>
      <title>Use Microsoft Graph to Check Synchronised On-Premises AD extensionAttributes 1-15</title>
      <link>https://docs.microsoft.com/archive/blogs/poshchap/use-microsoft-graph-to-check-synchronised-on-premises-ad-extensionattributes1-15</link>
      <pubDate>Wed, 25 Jul 2018 20:03:03 GMT</pubDate>
      <dc:creator><![CDATA[Ian Farr [MSFT]]]></dc:creator>
      <guid
        isPermaLink="false">https://blogs.technet.microsoft.com/poshchap/?p=6495</guid>
      <description><![CDATA[Hello, again!
It's been some time,
It's been 271 days,
This feels GOOD.
This feels like...
A...]]></description>
      <content:encoded><![CDATA[<span style="color: #808080"><strong><em>Hello, again!</em></strong></span>
<p style="padding-left: 30px">It's been some time,</p>
<p style="padding-left: 60px">It's been <strong>271</strong> days,</p>
<p style="padding-left: 90px">This feels <b><span style="color: #003000"><span style="color: #ff00ff">G</span><span style="color: #00ffff">O</span><span style="color: #ff9900">O</span><span style="color: #00ff00">D</span></span></b>.</p>
<p style="padding-left: 60px">This feels like...</p>
<p style="padding-left: 30px">A reacquaintance,</p>
<span style="color: #808080"><strong><em>Hello, old friend!</em></strong></span>

&nbsp;

Anyway, enough of that! Earlier this year we added the <strong>onPremisesExtensionAttributes</strong> complex type to the user entity, under directory APIs, in Microsoft Graph. This contains the synchronised on-premises <a href="https://technet.microsoft.com/en-us/library/aa997320(v=exchg.65).aspx">AD / Exchange extension attributes 1-15</a> that many of us have known and loved for many, many years... <strong>*sigh*</strong>

I was asked a question: <em>"How can we use Microsoft Graph to check for users that have extensionAttributes sync'd up to Azure AD?"</em>

When clarifying the request, the customer wasn't able to tell me which attributes were likely to be sync'd... I had to check them all.

&nbsp;

Here's what I did:
<ol>
 	<li>Fetched every user from MS Graph and selected the ‘<strong>UserPrincipalName</strong>’ and ‘<strong>onPremisesExtensionAttributes</strong>’ properties.</li>
 	<li>For each user, looped through the properties of the ‘<strong>onPremisesExtensionAttributes</strong>’ object and checked each ‘<strong>extensionAttribute</strong>’, i.e. 1 to 15.</li>
 	<li>When an ‘<strong>extensionAttribute</strong>’ was found to be populated, wrote the output to screen, showing the ‘<strong>UserPrincipalName</strong>’ with the ‘<strong>extensionAttribute</strong>’ and its value.</li>
</ol>
&nbsp;

Here's some sample output:
<p style="padding-left: 30px"><a href="https://msdnshared.blob.core.windows.net/media/2018/07/Capture269.png"><img width="400" height="426" class="alignnone wp-image-6505" alt="" src="https://msdnshared.blob.core.windows.net/media/2018/07/Capture269.png" /></a></p>
&nbsp;

The script will also dump out where a user has more than one '<strong>extensionAttribute</strong>' set:
<p style="padding-left: 30px"><a href="https://msdnshared.blob.core.windows.net/media/2018/07/Capture270.png"><img width="400" height="45" class="alignnone wp-image-6515" alt="" src="https://msdnshared.blob.core.windows.net/media/2018/07/Capture270.png" /></a></p>
&nbsp;

You'll need to set up a web app / API in your Azure AD tenant to query Microsoft Graph on your behalf. Below is a good article that contains a section on setting up a web app / API for a similar purpose. Start at the section '<em>Click on the <strong>Azure Active Directory</strong></em>' and give the application your own name and the necessary permissions to read user data.
<p style="padding-left: 30px"><a href="https://blogs.technet.microsoft.com/cloudyhappypeople/2018/04/11/leverage-the-microsoft-graph-with-azure-active-directory-identity-protection-to-identify-network-threats/">Leverage the Microsoft Graph with Azure Active Directory Identity Protection to Identify Network Threats</a></p>
&nbsp;

Now for the 'Shell:
<pre><code>
function Get-AzureADGraphAppToken {

    [CmdletBinding()]

    Param (
        #Target domain, e.g. contoso.com
        [Parameter(Mandatory=$false,
                   Position=0)]
        [string]$TenantDomain,

        #Client ID for app used to access graph
        [Parameter(Mandatory=$false,
                   Position=1)]
        [string]$ClientId,

        #Client secret used by app to access graph
        [Parameter(Mandatory=$false,
                   Position=2)]
        [string]$ClientSecret,

        #Switch for Azure AD graph token
        [switch]$AzureADGraph

    )
    

    #Nullify existing header
    $Header = $null
    
    if ($AzureADGraph) {

        #Azure AD Graph URL
        $Resource = "https://graph.windows.net/"

    }
    else {

        #MS Graph URL
        $Resource = "https://graph.microsoft.com"

    }

    
    #Login URL
    $LoginUrl = "https://login.microsoft.com"
    
    #Get a token
    $Body = @{grant_type="client_credentials";resource=$Resource;client_id=$ClientID;client_secret=$ClientSecret}
    $Oauth = Invoke-RestMethod -Method Post -Uri $LoginURL/$TenantDomain/oauth2/token?api-version=1.0 -Body $Body

    return $OAuth


}   #end of function



#Get a token
$OAuth = Get-AzureADGraphAppToken -TenantDomain "add_your_tenant_domain_here" `
                                  -ClientId "add_your_web_app_client_id_here" `
                                  -ClientSecret "add_your_client_secret_here_but_dont_leave_it_permanently_saved_here_at_rest"


    
#Header variable for REST call
$Header = @{'Authorization'="$($OAuth.token_type) $($OAuth.access_token)"}


#MS Graph Query
$Query = "https://graph.microsoft.com/beta/users?`$select=UserPrincipalName,onPremisesExtensionAttributes"


#Use do / while to repeat the query to fetch next 100 records
do {
    #Call REST method
    $Result = (Invoke-Restmethod -UseBasicParsing -Headers $Header -Uri $Query -Method Get)

    #For every user returned check each extension attribute for a value
    $Result.Value | ForEach-Object {

        #Variables for the current user and their attribute set
        $User = $_
        $Extensions = $User.onPremisesExtensionAttributes

        #Loop through each extension attribute and check for a value
        1..15 | ForEach-Object  {
    
            if ($Extensions."extensionAttribute$_") {
    
                #If an attribute is populated return it
                Write-Output "$($User.UserPrincipalName),extensionAttribute$_,$($Extensions."extensionAttribute$_")"

            }  

        }   

    }   
    
    $Query = $Result.'@odata.nextLink'
}
while($Query -ne $null)

</code></pre>]]></content:encoded>
    </item>
    <item>
      <title>Post #200! a.k.a A Brave New Blog</title>
      <link>https://docs.microsoft.com/archive/blogs/poshchap/post-200-a-k-a-a-brave-new-blog</link>
      <pubDate>Fri, 27 Oct 2017 07:45:10 GMT</pubDate>
      <dc:creator><![CDATA[Ian Farr [MSFT]]]></dc:creator>
      <guid
        isPermaLink="false">https://blogs.technet.microsoft.com/poshchap/?p=6265</guid>
      <description><![CDATA[&nbsp;

200! It only seems like yesterday that I was celebrating 100 posts. Fugit inreparabile...]]></description>
      <content:encoded><![CDATA[<p style="padding-left: 30px"><a href="https://msdnshared.blob.core.windows.net/media/2017/08/200.jpg"><img width="366" height="170" class="alignnone size-full wp-image-6266" alt="" src="https://msdnshared.blob.core.windows.net/media/2017/08/200.jpg" /></a></p>
&nbsp;

<span style="color: #333399"><strong>200!</strong></span> It only seems like yesterday that I was celebrating 100 posts. <em>Fugit inreparabile tempus!</em>

When I started blogging as PoSh Chap, I set myself the goal of producing a blog post each week. At times, it has been a tough target: there is such a thing as writer's block and also such things as deadlines and customer demands... but, PowerShell is my muse and what a muse she is! The good times far outweigh the bad.

And, so, it is with a sniff of sadness that I now announce a change in cadence, a.k.a. a brave new blog: I plan to post as and when appropriate, rather than on a weekly basis.

But, that's not all folks! The 200 milestone also coincides with my taking of a new role in Microsoft. I'm now going to be working in the Azure Active Directory Get-To-Production team, part of the Azure Engineering division. This move also informs my decision to change the publishing cadence. I suspect it will also transform the blog subject matter... all PowerShell related, of course!

Some interesting blog statistics*:
<ul>
 	<li>Consistently in top 3% of TechNet blogs</li>
 	<li>Consistently over 14,000 page views per month</li>
 	<li>Average 881 page views per day for lifetime of Blog</li>
 	<li>193 four star + ratings</li>
 	<li>332 comments</li>
 	<li>4 posts rated by MSDN as "Has possibly gone viral. This is full of win!"</li>
 	<li>Associated scripts on TechNet repository have 50,000+ downloads</li>
</ul>
<p style="padding-left: 30px"><em>*one for my manager!</em></p>
&nbsp;

Finally, I must thank every single one of you that has looked at one of my posts, from the single visitor to the subscribers. You are legend! Thanks to all those folks who have rated posts, added comments, pointed out typos, added their own code, suggested improvements or alternatives... you all contribute to the awesomeness of the PowerShell community. Thanks to PoSh, thanks to the PoSh family and thanks to the PoSh chickens.

Man, anyone would think I'm accepting an Oscar, not changing the post-frequency of a technology blog!

&nbsp;
<p style="padding-left: 30px"><a href="https://msdnshared.blob.core.windows.net/media/2017/09/Capture2591.png"><img width="1024" height="662" class="alignnone size-large wp-image-6365" alt="" src="https://msdnshared.blob.core.windows.net/media/2017/09/Capture2591-1024x662.png" /></a></p>
&nbsp;

A final <del>word</del> picture (for now)...

&nbsp;
<p style="padding-left: 30px"><a href="https://msdnshared.blob.core.windows.net/media/2017/09/mull.jpg"><img width="547" height="498" class="alignnone size-full wp-image-6375" alt="" src="https://msdnshared.blob.core.windows.net/media/2017/09/mull.jpg" /></a></p>
&nbsp;

Have fun!

&nbsp;

&nbsp;
<p style="padding-left: 30px"></p>]]></content:encoded>
    </item>
    <item>
      <title>One-Liner: Get Signing Algorithm for Personal Store Certificates</title>
      <link>https://docs.microsoft.com/archive/blogs/poshchap/one-liner-get-signing-algorithm-for-personal-store-certificates</link>
      <pubDate>Fri, 20 Oct 2017 07:11:27 GMT</pubDate>
      <dc:creator><![CDATA[Ian Farr [MSFT]]]></dc:creator>
      <guid
        isPermaLink="false">https://blogs.technet.microsoft.com/poshchap/?p=6455</guid>
      <description><![CDATA[A digital signature is created when a file is run through a hashing algorithm and the resultant hash...]]></description>
      <content:encoded><![CDATA[A digital signature is created when a file is run through a hashing algorithm and the resultant hash (digest / fingerprint) is then signed by a private key. If an application wants to check the integrity of a file, it can perform the following steps:
<ul>
 	<li>Decrypt the signed hash with the corresponding public key</li>
 	<li>Put the file through the same hash algorithm used as part of the original signing process o generate a hash</li>
 	<li>Compare the two hashes.</li>
</ul>
If the hashes are the same, the file hasn't been tampered with... assuming the hashing algorithm can still be trusted!

And therein lies the rub...

Md4 and MD5 haven't been trusted for a while and SHA1 is no longer considered secure against a well-resourced attackers. If you want details of Windows enforcement of SHA1 certificates, read <a href="https://social.technet.microsoft.com/wiki/contents/articles/32288.windows-enforcement-of-sha1-certificates.aspx">this</a>.

&nbsp;

How do you use PowerShell to check if your user account is using certificates signed by a CA with a SHA1 algorithm?

&nbsp;
<pre><code>
(Get-ChildItem Cert:\Currentuser\My\ | Select -Property SignatureAlgorithm -ExpandProperty SignatureAlgorithm).FriendlyName


</code></pre>
<a href="https://msdnshared.blob.core.windows.net/media/2017/10/Capture264.png"><img width="1024" height="121" class="alignnone size-large wp-image-6465" alt="" src="https://msdnshared.blob.core.windows.net/media/2017/10/Capture264-1024x121.png" /></a>

&nbsp;]]></content:encoded>
    </item>
    <item>
      <title>AD Groups with Low Member Count</title>
      <link>https://docs.microsoft.com/archive/blogs/poshchap/ad-groups-with-low-member-count</link>
      <pubDate>Fri, 13 Oct 2017 07:28:50 GMT</pubDate>
      <dc:creator><![CDATA[Ian Farr [MSFT]]]></dc:creator>
      <guid
        isPermaLink="false">https://blogs.technet.microsoft.com/poshchap/?p=6385</guid>
      <description><![CDATA[When I was a Systems Administrator, it was often tough to find time to be proactive and housekeep....]]></description>
      <content:encoded><![CDATA[When I was a Systems Administrator, it was often tough to find time to be proactive and housekeep. However, this is a key part of the role. What I used to do is dedicate time each week to expanding my arsenal of scripts. These little beauties performed the many mundane, but necessary, Active Directory housekeeping tasks.

Checking that groups are in use and have appropriate memberships, not only keeps your AD neat and tidy, it also reduces the available attack surface.

&nbsp;

Here's how to get a count of groups without any members:
<pre><code>
Get-ADGroup -Filter {members -notlike "*"} -Properties members | Measure-Object

</code></pre>
&nbsp;

<a href="https://msdnshared.blob.core.windows.net/media/2017/10/Capture263.png"><img width="1024" height="172" class="alignnone size-large wp-image-6436" alt="" src="https://msdnshared.blob.core.windows.net/media/2017/10/Capture263-1024x172.png" /></a>

&nbsp;

Here's how to get a count of groups with just one member:
<pre><code>

Get-ADGroup -Filter {members -like "*"} -Properties members | Where-Object {$_.members.count -le 1} | Measure-Object

</code></pre>
&nbsp;

<a href="https://msdnshared.blob.core.windows.net/media/2017/10/Capture262.png"><img width="1024" height="191" class="alignnone size-large wp-image-6435" alt="" src="https://msdnshared.blob.core.windows.net/media/2017/10/Capture262-1024x191.png" /></a>

&nbsp;

Looks like I need to do some work!

&nbsp;

Adjust the above PS as necessary...

&nbsp;

&nbsp;]]></content:encoded>
    </item>
    <item>
      <title>More on Get-Acl with Active Directory</title>
      <link>https://docs.microsoft.com/archive/blogs/poshchap/more-on-get-acl-with-active-directory</link>
      <pubDate>Fri, 06 Oct 2017 07:15:47 GMT</pubDate>
      <dc:creator><![CDATA[Ian Farr [MSFT]]]></dc:creator>
      <guid
        isPermaLink="false">https://blogs.technet.microsoft.com/poshchap/?p=6317</guid>
      <description><![CDATA[In June I posted about searching Active Directory for principals that have the "Write Members"...]]></description>
      <content:encoded><![CDATA[In June I <a href="https://blogs.technet.microsoft.com/poshchap/2017/06/16/get-active-directory-write-members-writeproperty/">posted</a> about searching Active Directory for principals that have the "Write Members" permission on a Distribution List.

I had a follow-up question, from an internal source, about deciphering each Access Control Entry (ACE) returned by <strong>Get-Acl</strong> against the Active Directory PS drive. I thought I'd convey the same information to the outside world.

&nbsp;

First up, let's dump the ACL for our distribution group from the Active Directory PS drive:
<pre><code>
(Get-Acl -Path "AD:CN=Distribution Group,OU=Groups").access

</code></pre>
&nbsp;

I'm going to pick out two ACEs:

<a href="https://msdnshared.blob.core.windows.net/media/2017/09/Capture253.png"><img width="600" height="177" class="alignnone wp-image-6326" alt="" src="https://msdnshared.blob.core.windows.net/media/2017/09/Capture253.png" /></a>

<a href="https://msdnshared.blob.core.windows.net/media/2017/09/Capture256.png"><img width="600" height="171" class="alignnone wp-image-6345" alt="" src="https://msdnshared.blob.core.windows.net/media/2017/09/Capture256.png" /></a>

&nbsp;

&nbsp;

The first is a <strong>ReadProperty</strong>, i.e. read permission, for a user called HALO\ryu... but what can Ryu actually read? Here's where we need to look up the <strong>ObjectType</strong> (<strong>SchemaIDGuid</strong>) in the Schema partition:

&nbsp;
<pre><code>
#ObjectType / SchemaIdGuid
[GUID]$RyuObjectType = "d7c53242-724e-4c39-9d4c-2df8c9d66c7a" 

Get-ADObject -SearchBase (Get-ADRootDSE).SchemaNamingContext -Filter {schemaidguid -eq $RyuObjectType} -Properties LdapDisplayName,SchemaIdGuid 

</code></pre>
&nbsp;

<a href="https://msdnshared.blob.core.windows.net/media/2017/09/Capture255.png"><img width="1024" height="273" class="alignnone size-large wp-image-6335" alt="" src="https://msdnshared.blob.core.windows.net/media/2017/09/Capture255-1024x273.png" /></a>

&nbsp;

So... Ryu can read the reapplication metadata of the distribution list... very interesting!

&nbsp;

Now, for the second ACE, that of the Vault Boy (HALO\vboy). As the <strong>ActiveDirectoryRights</strong> are<strong> ExtendedRight</strong>, this tells me that I need to use a different method to understand the permission, specifically looking up the <strong>RightsGuid</strong> in the Configuration partition.

&nbsp;
<pre><code>
#ObjectType / RightsGuid
$VboyObjectType = "ab721a55-1e2f-11d0-9819-00aa0040529b"

Get-ADObject -SearchBase (Get-ADRootDSE).ConfigurationNamingContext -Filter {(objectclass -eq "controlAccessRight") -and (rightsguid -eq $VboyObjectType)} -Properties RightsGuid,DisplayName

</code></pre>
&nbsp;

<a href="https://msdnshared.blob.core.windows.net/media/2017/09/Capture257.png"><img width="1024" height="254" class="alignnone size-large wp-image-6346" alt="" src="https://msdnshared.blob.core.windows.net/media/2017/09/Capture257-1024x254.png" /></a>

&nbsp;

So... Vault Boy has the extended right of <strong>Send To</strong>... nothing of concern for a distribution list.

&nbsp;

"How do we see all Extended Rights?", someone asks. Well, I wrote this post previously:
<p style="padding-left: 30px"><a href="https://blogs.technet.microsoft.com/poshchap/2017/04/14/use-powershell-to-list-active-directory-extended-rights/">Use PowerShell to List Active Directory Extended Rights</a></p>
&nbsp;

Here's a little snippet to capture all Extended Rights and the corresponding <strong>RightsGuid</strong>:
<pre><code>
Get-ADObject -SearchBase (Get-ADRootDSE).ConfigurationNamingContext -LDAPFilter "(&amp;(objectclass=controlAccessRight)(rightsguid=*))" -Properties RightsGuid,DisplayName | ForEach-Object {

    $RightsGuid = [pscustomobject]@{

        Name = $_.Name
        RightsGuid = [GUID]$_.RightsGuid
        DisplayName = $_.DisplayName

    }

    [array]$ExtendedRightsGuids += $RightsGuid

}

$ExtendedRightsGuids

</code></pre>
&nbsp;

And, finally, here's another snippet to capture all <strong>SchemaIdGuids</strong>:
<pre><code>
Get-ADObject -SearchBase (Get-ADRootDSE).SchemaNamingContext -LDAPFilter "(schemaidguid=*)" -Properties LdapDisplayName,SchemaIdGuid | ForEach-Object {

    $SchemaGuid = [pscustomobject]@{

        Name = $_.LdapDisplayName
        SchemaIdGuid = [GUID]$_.SchemaIdGuid

    }

    [array]$TotalGuids += $SchemaGuid

} 

$TotalGuids

</code></pre>
&nbsp;]]></content:encoded>
    </item>
    <item>
      <title>PowerShell in the Azure Portal... Oh, Happy Day!</title>
      <link>https://docs.microsoft.com/archive/blogs/poshchap/powershell-in-the-azure-portal-oh-happy-day</link>
      <pubDate>Fri, 29 Sep 2017 07:12:39 GMT</pubDate>
      <dc:creator><![CDATA[Ian Farr [MSFT]]]></dc:creator>
      <guid
        isPermaLink="false">https://blogs.technet.microsoft.com/poshchap/?p=6377</guid>
      <description><![CDATA[I was delivering some Azure training recently. I went to the shell icon in the Azure portal (see...]]></description>
      <content:encoded><![CDATA[I was delivering some Azure training recently. I went to the shell icon in the Azure portal (see <a href="https://blogs.technet.microsoft.com/poshchap/2017/09/15/powershell-in-the-azure-portal-almost/">here</a> for more information) and I started to explain how disappointed I still am with the PowerShell functionality being marked as 'coming soon'... then, to maximum excitement and amazement, PowerShell was blissfully available!

&nbsp;

<a href="https://msdnshared.blob.core.windows.net/media/2017/09/awesome.jpg"><img width="400" height="400" class="alignnone wp-image-6415" alt="" src="https://msdnshared.blob.core.windows.net/media/2017/09/awesome.jpg" /></a>

&nbsp;

How many cmdlets are available?

<a href="https://msdnshared.blob.core.windows.net/media/2017/09/Capture261.png"><img width="600" height="306" class="alignnone wp-image-6405" alt="" src="https://msdnshared.blob.core.windows.net/media/2017/09/Capture261-1024x523.png" /></a>

&nbsp;

Yes, that's 3449!

&nbsp;

Behold beauty:

<a href="https://msdnshared.blob.core.windows.net/media/2017/09/Capture260.png"><img width="1024" height="573" class="alignnone size-large wp-image-6395" alt="" src="https://msdnshared.blob.core.windows.net/media/2017/09/Capture260-1024x573.png" /></a>

&nbsp;

Oh, Happy Day!

&nbsp;

&nbsp;

&nbsp;

&nbsp;]]></content:encoded>
    </item>
    <item>
      <title>One-Liner: Query the AD Schema for User Object Attributes</title>
      <link>https://docs.microsoft.com/archive/blogs/poshchap/one-liner-query-the-ad-schema-for-user-object-attributes</link>
      <pubDate>Fri, 22 Sep 2017 07:32:24 GMT</pubDate>
      <dc:creator><![CDATA[Ian Farr [MSFT]]]></dc:creator>
      <guid
        isPermaLink="false">https://blogs.technet.microsoft.com/poshchap/?p=6305</guid>
      <description><![CDATA[I've lost count of just how many blog posts have their origin in a customer question. Here's...]]></description>
      <content:encoded><![CDATA[I've lost count of just how many blog posts have their origin in a customer question. Here's another:

&nbsp;
<p style="padding-left: 30px"><em>"How do you use PowerShell to get a list of what attributes *could* be populated on an AD user object?"</em></p>
&nbsp;

A magnificent question!

&nbsp;

The customer was unsure as to why some properties would appear as empty and other not appear at all when asking for <strong>-Properties *</strong>. Without searching online documentation, how would they have know that <strong>adminCount</strong>, for example, existed, as it only showed in the list of returned properties when actually populated.

In a couple of minutes I threw this together:

&nbsp;
<pre><code>
Get-ADObject -SearchBase (Get-ADRootDSE).SchemaNamingContext -Filter {name -like "User"} -Properties MayContain,SystemMayContain |
Select-Object @{n="Attributes";e={$_.maycontain + $_.systemmaycontain}} | 
Select-Object -ExpandProperty Attributes |
Sort-Object

</code></pre>
&nbsp;

The User class in the Active Directory schema has a couple of properties we can use to examine its attributes - MayContain, SystemMayContain. The above one-liner grabs both of these and combines them into a single property that we then sort on to display our list of possible attributes.

&nbsp;

<a href="https://msdnshared.blob.core.windows.net/media/2017/09/Capture250.png"><img width="800" height="382" class="alignnone wp-image-6315" alt="" src="https://msdnshared.blob.core.windows.net/media/2017/09/Capture250-1024x490.png" /></a>

&nbsp;

One final piece of the puzzle: there are more attributes available... these aren't defined in the schema, rather, these are cdreated programmatically when you ask for them. Here's how to list constructed attributes:

&nbsp;
<pre><code>
Get-ADObject -SearchBase (Get-ADRootDSE).SchemaNamingContext -ldapfilter '(systemFlags:1.2.840.113556.1.4.803:=4)' -Properties systemFlags |
Select-Object Name |
Sort-Object Name

</code></pre>

&nbsp;

<a href="https://msdnshared.blob.core.windows.net/media/2017/09/Capture251.png"><img width="800" height="545" class="alignnone wp-image-6316" alt="" src="https://msdnshared.blob.core.windows.net/media/2017/09/Capture251-1024x698.png" /></a>]]></content:encoded>
    </item>
    <item>
      <title>PowerShell in the Azure Portal... Almost!</title>
      <link>https://docs.microsoft.com/archive/blogs/poshchap/powershell-in-the-azure-portal-almost</link>
      <pubDate>Fri, 15 Sep 2017 06:41:42 GMT</pubDate>
      <dc:creator><![CDATA[Ian Farr [MSFT]]]></dc:creator>
      <guid
        isPermaLink="false">https://blogs.technet.microsoft.com/poshchap/?p=6275</guid>
      <description><![CDATA[&nbsp;

A little while back I noticed a new (but familiar) icon in the Azure portal (see...]]></description>
      <content:encoded><![CDATA[<a href="https://msdnshared.blob.core.windows.net/media/2017/09/Capture248.png"><img width="200" height="194" class="alignnone wp-image-6286" alt="" src="https://msdnshared.blob.core.windows.net/media/2017/09/Capture248.png" /></a>

&nbsp;

A little while back I noticed a new (but familiar) icon in the Azure portal (see below, not above)...

<a href="https://msdnshared.blob.core.windows.net/media/2017/09/Capture246.png"><img width="1024" height="78" class="alignnone size-large wp-image-6276" alt="" src="https://msdnshared.blob.core.windows.net/media/2017/09/Capture246-1024x78.png" /></a>

&nbsp;

I was gutted to see the following for PowerShell… coming soon!

<a href="https://msdnshared.blob.core.windows.net/media/2017/09/Capture247.png"><img width="600" height="241" class="alignnone wp-image-6285" alt="" src="https://msdnshared.blob.core.windows.net/media/2017/09/Capture247-1024x412.png" /></a>

&nbsp;

Good things come to those who wait, but if you can't wait you can sign up to a Private Preview by following link:
<p style="padding-left: 30px"><a href="https://aka.ms/PSCloudSignup">Coming Soon</a></p>
&nbsp;

As for the bash shell, to get you started:
<ul>
 	<li>aka/ms/cloudshell</li>
 	<li>aka.ms/az-clidocs</li>
 	<li>try these commands:
<ul>
 	<li>help</li>
 	<li>builtin help</li>
 	<li>az help</li>
 	<li>az account show</li>
</ul>
</li>
</ul>
&nbsp;

<a href="https://msdnshared.blob.core.windows.net/media/2017/09/Capture249.png"><img width="450" height="304" class="alignnone wp-image-6296" alt="" src="https://msdnshared.blob.core.windows.net/media/2017/09/Capture249.png" /></a>

&nbsp;

I'll provide notification as soon as PowerShell becomes available. If you want to post some feedback on the bash shell go here:
<p style="padding-left: 30px"><a href="https://feedback.azure.com/forums/598699-azure-cloud-shell">Cloud Shell Feedback</a></p>
&nbsp;]]></content:encoded>
    </item>
    <item>
      <title>Intelllisense in the Console</title>
      <link>https://docs.microsoft.com/archive/blogs/poshchap/intelllisense-in-the-console</link>
      <pubDate>Fri, 08 Sep 2017 07:18:48 GMT</pubDate>
      <dc:creator><![CDATA[Ian Farr [MSFT]]]></dc:creator>
      <guid
        isPermaLink="false">https://blogs.technet.microsoft.com/poshchap/?p=6207</guid>
      <description><![CDATA[You're running a cmdlet in the PowerShell.exe host console. You want to see what parameters are...]]></description>
      <content:encoded><![CDATA[You're running a cmdlet in the PowerShell.exe host console. You want to see what parameters are available to you. You can tab through them, after inputting a hyphen, until you get the one you want... but, how do you display them all and then chose the one you want, avoiding the help file?

&nbsp;

<strong> Enter  Intellisense, Stage Left</strong>

Instead of pressing tab after the hyphen, try Ctrl &amp; Space. You'll see this...

<a href="https://msdnshared.blob.core.windows.net/media/2017/08/Capture241.png"><img width="1024" height="129" class="alignnone size-large wp-image-6215" alt="" src="https://msdnshared.blob.core.windows.net/media/2017/08/Capture241-1024x129.png" /></a>

&nbsp;

Now, use the arrow keys to arrive at the parameter you want and press Space.

<a href="https://msdnshared.blob.core.windows.net/media/2017/08/Capture242.png"><img width="1024" height="138" class="alignnone size-large wp-image-6225" alt="" src="https://msdnshared.blob.core.windows.net/media/2017/08/Capture242-1024x138.png" /></a>

&nbsp;

You can also use Intellisense to show values that can be supplied to a parameter.

<a href="https://msdnshared.blob.core.windows.net/media/2017/08/Capture243.png"><img width="475" height="79" class="alignnone wp-image-6227" alt="" src="https://msdnshared.blob.core.windows.net/media/2017/08/Capture243.png" /></a>

&nbsp;

If there are too many results, input the first letter for Intellisense to work with, e.g. X and then use Ctrl &amp; Space.

<a href="https://msdnshared.blob.core.windows.net/media/2017/08/Capture245.png"><img width="1024" height="141" class="alignnone size-large wp-image-6245" alt="" src="https://msdnshared.blob.core.windows.net/media/2017/08/Capture245-1024x141.png" /></a>

&nbsp;

&nbsp;]]></content:encoded>
    </item>
  </channel>
</rss>