Upload files to "/"

This commit is contained in:
aaron 2023-12-18 18:18:44 +00:00
parent d3d964380f
commit bd2d4f02fd
3 changed files with 53 additions and 0 deletions

40
Get-UserReport.ps1 Normal file
View File

@ -0,0 +1,40 @@
$LogonEmail = Read-Host "Enter Logon Email"
Connect-ExchangeOnline -UserPrincipalName $LogonEmail
Connect-MgGraph -Scopes "Directory.Read.All"
Class User {
[string]$DisplayName
[string]$UserPrincipalName
[string]$Mail
[string]$AccountId
[string]$Id
[string]$SkuId
[string]$SkuPartNumber
[string]$Aliases
}
$accounts = Get-mgUser | Select-Object DisplayName,UserPrincipalName,Mail,Id
$Users =
ForEach ($account in $accounts){
$User = [User]::new()
$User.DisplayName = $account.DisplayName
$User.UserPrincipalName = $account.UserPrincipalName
$User.Mail = $account.Mail
$User.Id = $account.Id
$licence = Get-MgUserLicenseDetail -UserId $account.UserPrincipalName
$User.SkuId = $licence.SkuId
$User.SkuPartNumber = $licence.SkuPartNumber
$mailbox = Get-Mailbox -Identity $account.UserPrincipalName | Select-Object DisplayName,@{Name="EmailAddresses";Expression={$_.EmailAddresses | Where-Object {$_ -LIKE "SMTP:*"}}}
$User.Aliases = $mailbox.EmailAddresses
$User
}
$Users | Select-Object DisplayName,UserPrincipalName,SkuPartNumber,Mail,Aliases | ConvertTo-Csv | Out-File ".\UsersReport.csv"
Disconnect-MgGraph
Disconnect-ExchangeOnline

View File

@ -0,0 +1 @@
Install-Module -Name Microsoft.Graph

12
Replace-GroupMembers.ps1 Normal file
View File

@ -0,0 +1,12 @@
Connect-ExchangeOnline
$newnames = Import-Csv "" #Path to CSV with 1 column called 'Name' with the list of UserPrincipleNames to be added to the group
$group = "" #Name of the Group
$oldnames = Get-UnifiedGroupLinks -Identity $group -LinkType Members
ForEach ($oldname in $oldnames){Remove-UnifiedGroupLinks -Identity $group -LinkType Members -Links $oldname.name -Confirm $true}
ForEach ($newname in $newnames){Add-UnifiedGroupLinks -Identity $group -LinkType Members -Links $newname.Name}