Skip to content

Instantly share code, notes, and snippets.

@OlafD
OlafD / Transcript-Example-Program.cs
Last active October 23, 2018 10:21
A simple class to create transcript files for console applications. The filename for the transcript could be constructed by the constructor of the class to have the current date in the filename. Additionally an example for the usage.
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace TranscriptTester
{
class Program
{
@OlafD
OlafD / GetGroupOwnership.ps1
Last active October 11, 2018 09:36
For Office 365 get information about the ownership for Office 365 groups of a user, given by the mail address. Using this script needs the cmdlets for AzureAD (https://docs.microsoft.com/de-de/azure/active-directory/users-groups-roles/groups-settings-v2-cmdlets).
param (
[string]$UserMail
)
function Ensure-AzureADConnection
{
try
{
# $var = Get-AzureADTenantDetail
$var = Get-AzureADUser -Top 1
@OlafD
OlafD / LoopAllSubwebs-EmptyScript.ps1
Last active November 28, 2018 15:25
The starting point for a PowerShell script that loops all sites of a site collection to perform any function. The function(s) could be inserted starting in line 27. The script will write a transcript, the filename could be modified in line 51.
param (
[Parameter(Mandatory=$true)]
[string]$Url,
[Parameter(Mandatory=$true)]
[string]$TranscriptPath,
[Parameter(Mandatory=$true)]
$Credentials,
[switch]$IgnoreRoot
)
@OlafD
OlafD / Deploy-WebApp.ps1
Created October 8, 2018 06:32
Deploy a package for an Azure Web App, generated in Visual Studio, to Azure.
param (
[Parameter(Mandatory=$true)]
[string]$PublishSettingsFile,
[Parameter(Mandatory=$true)]
[string]$DeploymentBatch,
[Parameter(Mandatory=$true)]
[string]$WebAppUrl,
[switch]$Deploy
)
@OlafD
OlafD / GetGroupOwners.ps1
Created October 5, 2018 10:07
Get all the assigned owners of an Office 365 Groups group, also getting the owners in a Teams team. The script connects to Exchange Online to get the information.
param (
[string]$GroupName,
$Credentials
)
if ($Credentials -eq $null)
{
$Credentials = Get-Credential
}
@OlafD
OlafD / GetInstalledApps.ps1
Last active October 5, 2018 07:34
Show all installed apps from the app catalog for a SharePoint site. The script just provides a simple output of the AppTile class. The script needs the PowerShell PnP extensions installed.
param (
[string]$Url,
$Credentials
)
if ($Credentials -eq $null)
{
$Credentials = Get-Credential
}
@OlafD
OlafD / ConnectExchangeOnline.ps1
Last active January 11, 2024 12:51
Connect to Office 365 Exchange Online with PowerShell
if ($cred -eq $null)
{
$cred = Get-Credential
}
Write-Host "Connecting to Exchange Online"
$exchangeSession = New-PSSession -ConfigurationName Microsoft.Exchange -ConnectionUri https://outlook.office365.com/powershell-liveid/ -Credential $cred -Authentication Basic -AllowRedirection
Import-PSSession $exchangeSession | Out-Null