Skip to content

Instantly share code, notes, and snippets.

View kevinblumenfeld's full-sized avatar
🎯
Focusing

Kevin Blumenfeld kevinblumenfeld

🎯
Focusing
View GitHub Profile
function Get-LAMailboxHold {
[CmdletBinding()]
Param
(
[Parameter(Mandatory = $true,
ValueFromPipeline = $true,
ValueFromPipelineByPropertyName = $true)]
[string[]] $list
)
Begin {
function Get-LAcolTest {
[CmdletBinding()]
Param
(
)
Begin {
[CmdletBinding()]
Param
(
[Parameter(Mandatory = $false)]
[switch] $WithoutInPlaceHold,
[Parameter(Mandatory = $true,
ValueFromPipeline = $true,
ValueFromPipelineByPropertyName = $true)]
[string[]] $list
function Get-LAFolderSize {
<#
.Synopsis
Short description
.DESCRIPTION
Long description
.EXAMPLE
Example of how to use this cmdlet
.EXAMPLE
Another example of how to use this cmdlet
function Get-LAFolderSize {
Param(
[Parameter(
Mandatory = $true,
ValueFromPipelineByPropertyName = $true,
ValueFromPipeline = $true)]
[String]$userprincipalname
)
Begin {
$resultArray = @()
function Get-LAMfaStats {
<#
.Synopsis
Short description
.DESCRIPTION
Long description
.EXAMPLE
Example of how to use this cmdlet
.EXAMPLE
Another example of how to use this cmdlet
$searches = Get-ComplianceSearch | select name, @{n = "SharePoint"; e = {(Get-ComplianceSearch $_.identity).SharePointLocation}}
foreach ($row in $searches) {
$searchHash = @{}
if ($($row.SharePoint)) {
foreach ($site in $row.SharePoint) {
$searchHash['name'] = $row.name
$searchHash['SharePoint'] = $site
$resultArray += [psCustomObject]$searchHash
}
}
$searches = Get-ComplianceSearch | select name, @{n = "SharePoint"; e = {(Get-ComplianceSearch $_.identity).SharePointLocation}}
foreach ($row in $searches) {
$searchHash = @{}
if ($($row.SharePoint)) {
foreach ($site in $row.SharePoint) {
$searchHash['name'] = $row.name
$searchHash['SharePoint'] = $site
$resultArray += [psCustomObject]$searchHash
}
}
$resultArray = @()
$policies = Get-RetentionCompliancePolicy | Select name, guid, comment, type
$labels = Get-RetentionComplianceRule | Select Policy, RetentionComplianceAction, RetentionDuration, Priority, mode, ContentMatchQuery, disabled, @{n = "LabelName"; e = {($_.ComplianceTagProperty).split(",")[1]}}
$policyHash = @{}
foreach ($policy in $policies) {
$policyHash[$policy.guid] = $policy
}
foreach ($label in $labels) {
$labelHash = [ordered]@{}
$OutFile = ".\365PermissionExport.csv"
"DisplayName" + "," + "Alias" + "," + "PrimarySMTP" + "," + "FullAccess" + "," + "SendAs" + "," + "SendonBehalf" | Out-File $OutFile -Force -encoding ascii
$Mailboxes = import-csv .\someupns.csv
# $Mailboxes = Get-Mailbox -ResultSize:Unlimited
ForEach ($Mailbox in $Mailboxes)
{
$SendAs = Get-RecipientPermission $Mailbox.PrimarySmtpAddress | ? {$_.AccessRights -match "SendAs" -and $_.Trustee -ne "NT AUTHORITY\SELF"} | % {$_.trustee}
$FullAccess = Get-MailboxPermission $Mailbox.PrimarySmtpAddress | ? {$_.AccessRights -eq "FullAccess" -and !$_.IsInherited} | % {$_.User}
$sendbehalf=Get-Mailbox $Mailbox.PrimarySmtpAddress | select-object -ExpandProperty GrantSendOnBehalfTo