This file contains hidden or 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
$OutFile = "C:\Temp\PermissionExport.txt" | |
"DisplayName" + "," + "Alias" + "," + "Primary SMTP" + "," + "Full Access" + "," + "Send As" + "," + "Send on Behalf" | Out-File $OutFile -Force | |
$Mailboxes = Get-Mailbox -ResultSize:Unlimited | Select Identity, Alias, DisplayName, DistinguishedName, primarysmtpaddress | |
ForEach ($Mailbox in $Mailboxes) | |
{ | |
$SendAs = Get-ADPermission $Mailbox.DistinguishedName | ? {$_.ExtendedRights -like "Send-As" -and $_.User -notlike "NT AUTHORITY\SELF" -and !$_.IsInherited} | % {$_.User} | |
$FullAccess = Get-MailboxPermission $Mailbox.Identity | ? {$_.AccessRights -eq "FullAccess" -and !$_.IsInherited} | % {$_.User} | |
$sendbehalf=Get-Mailbox $Mailbox.Identity | select-object -expand grantsendonbehalfto | select-object -expand rdn | % {$_.User} | |
if (!$SendAs -and !$FullAccess -and !$sendbehalf){continue} |
This file contains hidden or 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
$hash = @{} | |
$text = 'lorem ipsum dolor sit amet consectetur adipiscing elit' | |
-split $text | ForEach-Object { | |
write-host "3: $3" | |
write-host "U: $_" | |
$1 = $2 | |
$2 = $3 |
This file contains hidden or 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
get-mailbox -resultsize Unlimited| select RetentionPolicy, count| group-object -property RetentionPolicy| sort-object count -Descending| | |
select name,count | | |
Export-Csv .\lausd\ProductionPulls\RetentionPolicyAssignmentCounts.csv -NoTypeInformation |
This file contains hidden or 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
if ($BaseSkuRemove) { | |
if ((Get-MsolAccountSku |where {$_.accountskuid -eq $PrimarySku}).consumedunits -lt (Get-MsolAccountSku |? {$_.accountskuid -eq $PrimarySku}).activeunits) { | |
for ($i = 0; $i -lt $BaseSkuRemove.count; $i++) { | |
Write-Host "NOT IN IF: $($user.licenses.accountskuid) $($BaseSkuRemove[$i])" | |
if ($user.licenses.accountskuid -contains $BaseSkuRemove[$i]) { | |
Write-Host "IN IF: $($user.licenses.accountskuid) $($BaseSkuRemove[$i])" | |
# Collect options of the SKU to add in the new sku THEN we will remove the old SKU | |
ForEach ($License in $user.licenses | Where {$_.AccountSkuID -eq $SkuE3}) { | |
$License.ServiceStatus | ForEach { | |
if (($_.ProvisioningStatus -eq "Disabled") -and ($_.ServicePlan.ServiceName -notin "FLOW_O365_P2", "POWERAPPS_O365_P2")) { |
This file contains hidden or 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
Function New-DynamicParameter { | |
[CmdletBinding(PositionalBinding = $false, DefaultParameterSetName = 'DynamicParameter')] | |
Param | |
( | |
[Parameter(Mandatory = $true, ValueFromPipeline = $true, ValueFromPipelineByPropertyName = $true, ParameterSetName = 'DynamicParameter')] | |
[ValidateNotNullOrEmpty()] | |
[string]$Name, | |
[Parameter(ValueFromPipelineByPropertyName = $true, | |
ParameterSetName = 'DynamicParameter')] |
This file contains hidden or 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
<# | |
.SYNOPSIS | |
Helper function to simplify creating dynamic parameters | |
.DESCRIPTION | |
Helper function to simplify creating dynamic parameters. | |
Example use cases: | |
Include parameters only if your environment dictates it | |
Include parameters depending on the value of a user-specified parameter |
This file contains hidden or 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
function Get-CloudSkuTable { | |
<# | |
.Synopsis | |
Short description | |
.DESCRIPTION | |
Long description | |
.EXAMPLE | |
Example of how to use this cmdlet | |
.EXAMPLE | |
Another example of how to use this cmdlet |
This file contains hidden or 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
function Set-LACloudLicenseV2 { | |
[CmdletBinding(SupportsShouldProcess = $true, ConfirmImpact = 'High')] | |
Param | |
( | |
[Parameter(Mandatory = $true, ValueFromPipeline = $true)] | |
[string[]] $pipelineUser | |
) | |
DynamicParam { | |
$DynamicParameters = @( |
This file contains hidden or 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
Service | |
AAD_PREMIUM | |
AAD_PREMIUM_P2 | |
ADALLOM_S_O365 | |
ADALLOM_S_STANDALONE | |
ATP_ENTERPRISE | |
BI_AZURE_P1 | |
BI_AZURE_P2 | |
CRMIUR | |
CRMSTANDARD |
This file contains hidden or 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
FORMS_PLAN_E5 | |
STREAM_O365_E5 | |
THREAT_INTELLIGENCE | |
Deskless | |
FLOW_O365_P3 | |
POWERAPPS_O365_P3 | |
TEAMS1 | |
ADALLOM_S_O365 | |
EQUIVIO_ANALYTICS | |
LOCKBOX_ENTERPRISE |