Upload files to "/"
This commit is contained in:
parent
d3d964380f
commit
bd2d4f02fd
40
Get-UserReport.ps1
Normal file
40
Get-UserReport.ps1
Normal 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
|
1
Install-MicrosoftGraph.ps1
Normal file
1
Install-MicrosoftGraph.ps1
Normal file
@ -0,0 +1 @@
|
|||||||
|
Install-Module -Name Microsoft.Graph
|
12
Replace-GroupMembers.ps1
Normal file
12
Replace-GroupMembers.ps1
Normal 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}
|
||||||
|
|
Loading…
x
Reference in New Issue
Block a user