Saturday , April 20 2024
Home - Tag Archives: Powershell

Tag Archives: Powershell

Easy Find OU in a DistinguishedName with PowerShell

There are a couple of ways to find the OU of an Object, some are long-winded ways splitting and counting characters.  The best way I’ve come up with for a quick and case insensitive check: [crayon-6622dbbd94610058341999/] A better example of the use in code: [crayon-6622dbbd94616437757188/] The Case Culture fixes up the compare of string being a different case of “OU=”, …

Read More »

The pain of TLS 1.2 with PowerShell module for Azure Active Directory (MSOnline)

Building labs in a hurry sometimes can bite you with recent changes in Office 365 connections.  I just got hit with a problem with PowerShell module for Azure Active Directory not connecting: [crayon-6622dbbd9476f443227449/] The problem relates to the connection type from a very unpatched (on purpose) Windows 2016 lab server for developing a Powershell script against Azure AD.  While working out …

Read More »

Quickly Adding Active Directory Group Members using a LDAP filter

There are times when you need a quick one-liner to add Active Directory group membership based on users selected by some data. In this case I needed to move AD users into AD Distribution lists based on their email (mail attribute) externally managed information. The following script finds the users be looking at the LDAP filter of mail = *@domaintochek.com …

Read More »

Using PowerShell to Connect to Domino NAB

There are times where I need to compare Domino Address Books (NAB) to Active Directory.  Using PowerShell to connect to Domino NAB solves this with ease, although we have to use logon details with no authentication method.  A little strange but Domino accepts the ‘[System.DirectoryServices.AuthenticationTypes]::None’ fromPowerShell. [crayon-6622dbbd948bc806258164/] Changing DominoSrv01, Organisation Name, Username and Password for the environment. [crayon-6622dbbd948bf674029339/] Make a connection …

Read More »

How to invoke/test Office 365 (Exchange Online) cmdlets via Remote Powershell

I’ve been working on some PowerShell scripts for use with Office 365 and needed to invoke/test Office 365 (Exchange Online) cmdlets via RemotePowerShell.  This post relates to connections to Office 365 and Exchange online. My previous post How to invoke test exchange 2010 cmdlets via remote PowerShell 2.0 window, however the following allows for the credentials to be different from the …

Read More »

Creating Dynamic Distribution Groups

Ive been asked to create a Distribution Group based on Users City Value.  The following Powershell commands create a example Office based group. Once Powershell for On-premises or Office 365 shell has been started.  Enter the following command changing as required: [crayon-6622dbbd949ac118711817/] To enable the Mail tip use this additional command: [crayon-6622dbbd949af698744556/] The following command will test and display which users will receive the email from …

Read More »

Powershell Get-Counters in a usable form from CookedValue

Sometime ago now I was given the challenge to get the value out of a get-counter in a Powershell, I thought the answer snippet should be posted for future reference. The following Powershell command gives a value buried with result information. [crayon-6622dbbd94a31619206114/] The result is given: [crayon-6622dbbd94a34597955585/] To get the true value to be used in other powershell code we …

Read More »

Updating Active Directory User Objects from CSV files

Sometimes it’s better to get updates for Active Directory objects supplied in the form of a Excel spreadsheet.  Using the information you can then run the following script to update objects with information contain the rows/columns of a spreadsheet (CSV file).  What makes this a little simplier the column headers are the AD properties to be udpated. Another issue covered in …

Read More »

How to invoke/test Exchange 2010 cmdlets via Remote Powershell 2.0 window

I’ve been working on a issue with WinRM and thought I would share the steps to test WinRM is working correctly.  This results in the Exchange 2010 Cmdlets being available on a Powershell 2.0 window without Exchange Management tools being installed.  Note: you must be have Exchange admin role assigned to the current logged in user i.e. can not be …

Read More »

Exchange 2010 Add Mailbox folder permissions including subfolders

I’m always asked how to add a user to have Mailbox folder permissions for a folder and sub-folder in another users mailbox.  Exchange 2010 (SP1 for Set)  includes to new commands ‘Add-MailboxFolderPermission’ and ‘Set-MailboxFolderPermission’. Save the following in a new .ps1 file and run with Exchange management rights making changes to the script as required. ForEach($folder in (Get-MailboxFolderStatistics MailAliasofSharer| Where { …

Read More »