test.ps1
Connect-MgGraph -Scopes User.ReadWrite.All, Organization.Read.All Function Update-UserLicense { [cmdletbinding()] Param($User) $e3Sku = Get-MgSubscribedSku -All | Where-Object SkuPartNumber -eq 'SPE_E3' $e1Sku = Get-MgSubscribedSku -All | Where-Object SkuPartNumber -eq 'SPE_E1' Write-Verbose $User Foreach ($Individual in $User){ Write-Verbose $Individual # Unassign E3 Set-MgUserLicense -UserId $Individual -AddLicenses @{} -RemoveLicenses @($e3Sku.SkuId) # Assign E1 Set-MgUserLicense -UserId $Individual -AddLicenses @{SkuId = $e1Sku.SkuId} -RemoveLicenses @() #display user and current license $Individual Get-MgUserLicenseDetail -UserId $Individual } } Connect-MgGraph -Scopes "Directory.ReadWrite.All, Group.ReadWrite.All" Select-MgProfile -Name "beta" Get-mggroup -filter "groupTypes/any(c:c eq 'Unified')" | Select-Object -expand WritebackConfiguration Set-MgGroup -filter Disconnect-MgGraph Connect-MgGraph -TenantId '77a7ebb7-ae63-4259-9307-d2683e631623' ` -ClientId 'dcb0dcea-e8d2-4561-94c2-5a18be45eaca' ` -CertificateThumbprint '9CB02FA5A9AA03B5E3E0B3054CF13956711BF5F2' $a = Invoke-MgGraphRequest -Method get -uri 'https://graph.microsoft.com/v1.0/users/2b009992-e963-4b7c-90e4-547e8c0d34c3/events' $a.value | Select-Object subject, iscancelled get-mguser get-command -module Microsoft.Graph.Security | out-file c:\temp\security.txt notepad.exe c:\temp\security.txt Rules Syntax (user.assignedPlans -any (assignedPlan.servicePlanId -eq "2bdbaf8f-738f-4ac7-9234-3c3ee2ce7d0f" -and assignedPlan.capabilityStatus -eq "Enabled")) and (user.assignedPlans -any (assignedPlan.servicePlanId -eq "818523f5-016b-4355-9be8-ed6944946ea7" -and assignedPlan.capabilityStatus -eq "Enabled")) Service plans: Project P3 (818523f5-016b-4355-9be8-ed6944946ea7) Visio web app (2bdbaf8f-738f-4ac7-9234-3c3ee2ce7d0f) Get-AcceptedDomain | Get-DKIMSigningConfig | Select-Object DomainName Get-AdvancedThreatProtectionDocumentDetail | gm Get-AdvancedThreatProtectionDocumentReport | gm Get-ATPBuiltInProtectionRule | gm Get-ATPEvaluation | gm get-mailbox | Get-MailboxJunkEmailConfiguration get-mailbox -ResultSize unlimited | Get-MailboxJunkEmailConfiguration | Where-Object -Property ContactsTrusted -eq $true | Select-Object -Property Identity,ContactsTrusted Get-ManagementRoleAssignment -GetEffectiveUsers | Where-Object -Property RoleAssigneeName -eq "Organization Management" | Group-Object -Property EffectiveUserName | Measure-Object | Select-Object count Get-ManagementRoleAssignment -GetEffectiveUsers Get-ExternalInOutlook | gm Get-InboundConnector | gm get-hostedcontentfilterpolicy | gm Disconnect-ExchangeOnline (Get-EXOMailbox -propertyset all -RecipientTypeDetails SharedMailbox -Identity "sharedMBX" -Properties ExchangeSecurityDescriptor).DiscretionaryAcl.Count |