This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#Specify users you need to extract contactlist from. | |
$users = "alexander@contoso.com" | |
#Specify contactlist folder you need to export. Have added wildcard in the request, so if you are exporting all folders thats starts with Skype, enter "Skype" as foldername. | |
#Enter "root" as foldername if you want all contacts that are not in a folder. | |
$folder = "skype" | |
function Get-MSGraphAppToken{ | |
<# .SYNOPSIS |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$connection = Get-AutomationConnection -Name AzureRunAsConnection | |
$tenant = 'alexholmeset.onmicrosoft.com' | |
Connect-ExchangeOnline -CertificateThumbprint $connection.CertificateThumbprint -AppId $connection.ApplicationID -ShowBanner:$false -Organization $tenant | |
Get-MessageTrace |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$credential = Get-AutomationPSCredential -Name 'Exchange' | |
$session = New-PSSession -ConfigurationName Microsoft.Exchange -ConnectionUri 'https://outlook.office365.com/powershell-liveid/' -Credential $credential -Authentication Basic -AllowRedirection | |
Import-Module (Import-PSSession -Session $session -DisableNameChecking -AllowClobber ) -Global | |
$TodaysDate = Get-Date (Get-Date).AddDays(-1) -Format 'MM/dd/yyyy' | |
$NumberOfInternalEmails = (Get-MessageTrace -StartDate $TodaysDate -EndDate $TodaysDate | Where-Object{$_.'SenderAddress' -like '*alexholmeset.onmicrosoft.com'} | Where-Object{$_.'RecipientAddress' -like '*alexholmeset.onmicrosoft.com'}).count |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#Set Defaults (Optional) which allows you to skip defining instance, user, and password each time | |
$AzureDefaultInstanceName = "ServerName" | |
$AzureDefaultDatabaseName = "DatabaseName" | |
$username = Get-AutomationVariable -Name 'Administrator' | |
$password = Get-AutomationVariable -Name 'Password' | |
#The actual function |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$url = 'https://tas.teams.microsoft.com/v2/teams/summary-timeseries?timeperiod=last-ninety-days&includeTimeSeries=ActiveUsers&metrics=all&pagesize=20&nextCursor=null' | |
$token = 'CI6IjE4YzRhOTFiLTRmYTktNGZiZC1hYjFjLWIzOTQ' | |
$Header = @{"Authorization" = "Bearer $token" } | |
$data = Invoke-RestMethod -Uri $url -Method GET -Headers $Header -ContentType 'application/json' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$url = 'https://tas.teams.microsoft.com/v2/teams/summary-timeseries?timeperiod=last-ninety-days&includeTimeSeries=ActiveUsers&metrics=all&pagesize=20&nextCursor=null' | |
$token = 'CI6IjE4YzRhOTFiLTRmYTktNGZiZC1hYjFjLWIzOTQ' | |
$Header = @{"Authorization" = "Bearer $token" } | |
$data = Invoke-RestMethod -Uri $url -Method GET -Headers $Header -ContentType 'application/json' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#Set Defaults (Optional) which allows you to skip defining instance, user, and password each time | |
$AzureDefaultInstanceName = "teamssqlserver" | |
$AzureDefaultDatabaseName = "teamssqldatabase" | |
$AzureDefaultUserID = "username" | |
$AzureDefaultPassword = "password" | |
#The actual function | |
Function get-azureSQL ( | |
[string]$DatabaseName = $AzureDefaultDatabaseName, |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#Set Defaults (Optional) which allows you to skip defining instance, user, and password each time | |
$AzureDefaultInstanceName = "teamssqlserver" | |
$AzureDefaultDatabaseName = "teamssqldatabase" | |
$AzureDefaultUserID = "username" | |
$AzureDefaultPassword = "password" | |
#The actual function | |
Function get-azureSQL ( | |
[string]$DatabaseName = $AzureDefaultDatabaseName, | |
[string]$InstanceName = $AzureDefaultInstanceName | |
,[string]$UserID = $AzureDefaultUserID |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#"Password!" | ConvertTo-SecureString -AsPlainText -Force | ConvertFrom-SecureString | Out-File "D:\temp\PassordUserExpireScript.txt" | |
$Credentials = New-Object -TypeName System.Management.Automation.PSCredential -ArgumentList "admin@contoso", (Get-Content "d:\temp\PassordUserExpireScript.txt" | ConvertTo-SecureString) | |
#Gets all users thats enabled and have a expiration date. | |
$Users = Get-ADUser -Filter * -Properties AccountExpirationDate | select AccountExpirationDate,Enabled,UserPRincipalName,samaccountname,name | Where-Object{$_.Enabled -eq $true -and $_.AccountExpirationDate} | |
#Todays date. | |
$today = Get-Date -Format dd/MM/yyyy |
NewerOlder