Categories
Azure Office 365 PowerShell

Office 365: Managing your users through PowerShell

If you’re like me, then you tend to find yourself wanting to automate as much as possible, or at least be able to work with sets of data in a way that quickly allows you to get to the root of an issue rather than clicking through endless screens of information.

In case you were curious, Office 365 makes use of Azure Active Directory behind the scenes for user managment. As Azure Active Directory is an enterprise resource for identity management for cloud hosted applications, Microsoft has gone to great length to create several interfaces to it. Granted, I could just use a REST call through the Microsoft Graph API to create or delete a user through a POST command, but I can also use PowerShell from a Windows based device.

For user management, our first step is to download the appropriate PowerShell Module.  This can be done simply by installing the module through PowerShell running

install-module -name azuread

This will install the PowerShell module specifically for Azure AD and allow you to manage your users. From there before you can make any changes to your user base you’ll need to authenticate. An easy way to do this is as follows:

$creds = get-credential -credential
connect-azure-ad -credential $creds

From there you can parse your users and make modifications to your hearts desire. Running “Get-AzureADUser” enumerates all user objects.  Load it into an array and work with the users as you wish.

Nevertheless, for more on this topic, check out the Microsoft Support docs over at:

https://docs.microsoft.com/en-us/office365/enterprise/powershell/connect-to-office-365-powershell

https://www.powershellgallery.com/packages/AzureAD/2.0.1.3

Categories
PowerShell

Loading the SharePoint 2010 Management PowerShell

So someone asked me today, “What if I don’t want to use the SharePoint 2010 Management PowerShell”?

I looked blankly at them and thought to myself, “Well that’s just silly…” and then decided to look into the matter 🙂

So it’s pretty easy to add the SharePoint snapin for PowerShell. You can do this manually, or you can simply run the SharePoint powershell script that adds the snapin and sets your location.

Okay, but where is this cute little script located?

%InstallRoot%Program FilesCommon FilesMicrosoft SharedWeb Server Extensions14CONFIGPOWERSHELLRegistrationSharePoint.ps1

Of course if you’ve set up links properly you can quickly get to this through some other means of a symlink to 14-root.

Nonetheless, in case you don’t feel like going into the Microsoft SharePoint 2010 Products from the menuing interface of Windows and prefer PowerShell, then there you have it.

Happy PowerShelling!